Register Members List Search Today's Posts Mark Forums Read

Reply
 
Thread Tools
  #1  
Old 31 Oct 2019, 14:38
Zweeper Zweeper is offline
 
Join Date: Jan 2005
Excel 2 Forum

Good day everybody,

I have an excel file with different rows and I want to create threads with content out of each row.
Is there already something like a phyton script available for this?

If not, can you give me some tipps and advice to start off how I could cope with something like this?
Maybe there is even a coder who could code something like this in python for me?


Greetings!
Reply With Quote
  #2  
Old 31 Oct 2019, 14:52
Dave Dave is offline
 
Join Date: Jun 2010
Real name: Dave
Is there a reason you want to use Python even though vBulletin 5 is created using PHP?

Using PHP you can read the Excel file and iterate through each row and then insert the thread.

Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

__________________
https://technidev.com - security, development, exploits, vBulletin
dave[at]technidev[dot]com

Contact me for custom vBulletin 3/4 work & server/website management.
Reply With Quote
  #3  
Old 31 Oct 2019, 14:53
Zweeper Zweeper is offline
 
Join Date: Jan 2005
no, just because I am more into python at the moment.
Thanks already for the script. But how can I tell it to get the data from my excel exactly? Is there an example?

--------------- Added 31 Oct 2019 at 15:34 ---------------

The excel file is structured as


colum 1 = title
colum = thread content


there are x rows whereby each row should be a different thread.
I understand the code you wrote there, but I dont get how I can link this to an excel file.



Can you help me here?

--------------- Added 31 Oct 2019 at 17:42 ---------------

It hasnt necessarly to be excel 2 vbulletin. Right now I just have all the data in an excel file.

Last edited by Zweeper; 31 Oct 2019 at 15:00.
Reply With Quote
  #4  
Old 02 Nov 2019, 12:00
Zweeper Zweeper is offline
 
Join Date: Jan 2005
I came a bit closer to the solution I guess, got some help from another guy regarding the importing problem from a csv file. But I can't get it working.


Anyone, any help here?







Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

Reply With Quote
  #5  
Old 02 Nov 2019, 12:40
Dave Dave is offline
 
Join Date: Jun 2010
Real name: Dave
Something like:


Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

You still need to modify the parentid and userid value.
Pretty sure the script you gave is not valid though because it calls the $rowfields variable which does not exist.
__________________
https://technidev.com - security, development, exploits, vBulletin
dave[at]technidev[dot]com

Contact me for custom vBulletin 3/4 work & server/website management.
Reply With Quote
  #6  
Old 02 Nov 2019, 13:08
Zweeper Zweeper is offline
 
Join Date: Jan 2005
thanks, I finally got it working. Many thanks 2 you!

Last edited by Zweeper; 02 Nov 2019 at 16:54.
Reply With Quote
  #7  
Old 06 Apr 2020, 07:28
Zweeper Zweeper is offline
 
Join Date: Jan 2005
Hey Dave, the script works like a charm, thank you so much again for your help!


There just came up another question from my side. When I work with larg csv files (more than about 1000 lines) the script runs longer than the max. execution time allowed by my server. The most of the times I split the files into separate files, what works of course.



But is there a "simple" way to update the script so that it also works with large files without running into problems with the max. execution time?



Regards!
Reply With Quote
  #8  
Old 06 Apr 2020, 10:15
shka shka is offline
 
Join Date: Mar 2016
Try


Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.


Last edited by shka; 06 Apr 2020 at 10:27.
Reply With Quote
  #9  
Old 10 Apr 2020, 09:08
Zweeper Zweeper is offline
 
Join Date: Jan 2005
Seems to work, many thanks!
Reply With Quote
  #10  
Old 13 Apr 2020, 11:15
Zweeper Zweeper is offline
 
Join Date: Jan 2005
Ok it is working, but not for me, since I cant change the set_time_limit at more than 90 seconds.



I could split my csv file into several files and then create several scripts which I have to run each after another.


like:


import_n.php imports import_n.csv
n+1





Is there a way to automatically start import_2.php when import_1 is finished?
Reply With Quote
  #11  
Old 13 Apr 2020, 15:32
shka shka is offline
 
Join Date: Mar 2016
I wrote 30, not 90 or more. (The call in each loop resets the time limit. )

But note: If the restriction is set by your shared host provider resetting or any other solution (split or various cronjobs) could be not in accordance to the using rules. Cause same effect - "high" cpu utilization.

But you can also split your file automated and localy and call your imports (from different sources or with little sleeps)

Last edited by shka; 13 Apr 2020 at 15:47.
Reply With Quote
  #12  
Old 13 Apr 2020, 15:43
Zweeper Zweeper is offline
 
Join Date: Jan 2005
Yes i know, thanks

But it seems to be blocked from server side and they stop each script after a maximum of 90 seconds of runtime and I will receive the following message:




"Internal Server Error
The server encountered an internal error or misconfiguration and was unable to complete your request.
Please contact the server administrator at [no address given] to inform them of the time this error occurred, and the actions you performed just before this error.
More information about this error may be available in the server error log."
Reply With Quote
  #13  
Old 13 Apr 2020, 15:53
shka shka is offline
 
Join Date: Mar 2016
And if I remember the first post - you can call all directly from excel via post or frontend controller.
Reply With Quote
  #14  
Old 13 Apr 2020, 16:22
Zweeper Zweeper is offline
 
Join Date: Jan 2005
How does that work?
Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


New To Site? Need Help?

All times are GMT. The time now is 10:36.

Layout Options | Width: Wide Color: