botsimmer 16 Posted October 28, 2015 Report Share Posted October 28, 2015 Hi folks,I am trying to scrape 2 columns and set the header names using set table cell then save into seperate columns in csv file. I cannot seem to figure out why my code is not saving the content correclty but it saves it all in 1 column: wait(5)set(#title,$scrape attribute(<class=w"sinckw-sinck-inner">,"innertext"),"Global")set(#parag,$scrape attribute(<class=w"sinckwpara-inner">,"innertext"),"Global")set(#row,"-1","Global")wait(5)clear table(&data)set table cell(&tabledata,0,0,"Title")set table cell(&tabledata,0,1,"Paragraph")wait(5)set table cell(&tabledata,0,0,#title)set table cell(&tabledata,0,1,#parag)clear list(%listings)loop($table total rows(&tabledata)) { increment(#row) add item to list(%listings,$table cell(&tabledata,#row,0),"Don\'t Delete","Global") add item to list(%listings,$table cell(&tabledata,#row,1),"Don\'t Delete","Global")}wait(5)save to file("{$special folder("Application")}\\news-content1.csv",%listings) Any assistance would be much appreciated. Thanks Quote Link to post Share on other sites
pash 504 Posted October 28, 2015 Report Share Posted October 28, 2015 Not sure. Because you do not provide the complete code.And it is quite confusing set(#title,$scrape attribute(<class=w"sinckw-sinck-inner">,"innertext"),"Global") set(#parag,$scrape attribute(<class=w"sinckwpara-inner">,"innertext"),"Global") clear table(&data) set table cell(&tabledata,0,0,"Title") set table cell(&tabledata,0,1,"Paragraph") set table cell(&tabledata,1,0,#title) set table cell(&tabledata,1,1,#parag) clear list(%listings) set(#row,1,"Global") loop($subtract($table total rows(&tabledata),1)) { add item to list(%listings,$table cell(&tabledata,#row,0),"Don\'t Delete","Global") add item to list(%listings,$table cell(&tabledata,#row,1),"Don\'t Delete","Global") increment(#row) } save to file("{$special folder("Application")}\\news-content1.csv",%listings) Quote Link to post Share on other sites
botsimmer 16 Posted October 28, 2015 Author Report Share Posted October 28, 2015 I did have a few Waits in between the set table cell and Onload for Navigate. Th table comes out in the correct format in the debugger but in the speadsheet its in 1 column Quote Link to post Share on other sites
pash 504 Posted October 28, 2015 Report Share Posted October 28, 2015 I did have a few Waits in between the set table cell and Onload for Navigate. Th table comes out in the correct format in the debugger but in the speadsheet its in 1 column I still do not understand what you are doing.try. set(#title,$scrape attribute(<class=w"sinckw-sinck-inner">,"innertext"),"Global") set(#parag,$scrape attribute(<class=w"sinckwpara-inner">,"innertext"),"Global") clear table(&data) set table cell(&tabledata,0,0,"Title") set table cell(&tabledata,0,1,"Paragraph") set table cell(&tabledata,1,0,#title) set table cell(&tabledata,1,1,#parag) save to file("{$special folder("Application")}\\news-content1.csv",&tabledata) Quote Link to post Share on other sites
botsimmer 16 Posted October 29, 2015 Author Report Share Posted October 29, 2015 Thanks Pash,But the idea is that Title shpuld populate Column 1 and Paragraph Column 2 which is seen in the debug but not inthe csv fil. In the csv file both title and paragraph are in column 1.set(#row,"-1","Global")was supposed to represent zero based indexing to compensate for row 0. Quote Link to post Share on other sites
botsimmer 16 Posted October 29, 2015 Author Report Share Posted October 29, 2015 Finally worked it out. I used 'add list to list' then referenced them to 'add list to table as column' Thanks Quote Link to post Share on other sites
pablo322 1 Posted June 5, 2016 Report Share Posted June 5, 2016 know someone who can help me , I do not think it's so hard to help .... as is done to select the column and row to save the data ? A B C D 1 MAIL PASSWORD RECOVERY MAIL PHONE NUMBER 2 UYH@HOTMAIL.COM RFVHJIBRVFUI UYH@MAILNESIA.COM 1141651919581 3 EDYH@HOTMAIL.COM EIVU89FHNRFU EDYH@MAILNESIA.COM 1654981496158 Quote Link to post Share on other sites
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.