itexspert 47 Posted January 11, 2015 Report Share Posted January 11, 2015 Guys i have an issue i don't know why does my CSV file contain Line Breaks?This is the script for scraping so what did i do wrong? This all started happening few days ago when i Reinstalled my Windows 7 so i don't know what did i do wrong!Once this script is done i get a File which is attached so you can take a look Usually when i scrape some info i import it into excel and immediately my Excel starts its Importing wizard but Excel is treating this like a simple txt file and i made sure inside the script it has to be saved as a CSV file! So what is my mistake? EDIT: I added my Debugger Image so you can see how the data looks like in there so i don't understand this issue??? Any Ideas?? loop($list total(%Linkovi)) { navigate("http://www.walgreens.com{$next list item(%Linkovi)}","Wait") set(#product name,$scrape attribute(<itemprop="name">,"innertext"),"Global") set(#Price,$scrape attribute(<id="vpdSinglePrice">,"innertext"),"Global") wait for browser event("Page Loaded","") wait for browser event("Everything Loaded","") wait for browser event("DOM Ready","") set table cell(&Wallgreens,0,0,"PRODUCT NAME") set table cell(&Wallgreens,0,1,"PRODUCT PRICE") set table cell(&Wallgreens,#row,0,#product name) set table cell(&Wallgreens,#row,1,#Price) increment(#row) comment("Clean Up Table") set(#Row,0,"Global") loop($table total rows(&Wallgreens)) { set(#Col,0,"Global") loop($table total columns(&Wallgreens)) { if($comparison($table cell(&Wallgreens,#Row,#Col),"=","")) { then { set table cell(&Wallgreens,#Row,#Col,"Priced Per Store") } else { } } increment(#Col) } increment(#Row) } save to file("{$special folder("Desktop")}\\Walgreens.csv",&Wallgreens)}Walgreens.csv Quote Link to post Share on other sites
dyvel 20 Posted January 11, 2015 Report Share Posted January 11, 2015 From the debugger screenshot, it looks like you have line breaks in 1, 2 and 8, and that matches with your csv for those at least. Quote Link to post Share on other sites
dyvel 20 Posted January 11, 2015 Report Share Posted January 11, 2015 You could try using $trim to remove trailing blank spaces - not sure it will remove a line break though: set(#product name,$trim($scrape attribute(<itemprop="name">,"innertext")),"Global") Quote Link to post Share on other sites
itexspert 47 Posted January 11, 2015 Author Report Share Posted January 11, 2015 Ok thanks for reply but why is this happening now i am sure there were line breaks before and this never happened?? Quote Link to post Share on other sites
itexspert 47 Posted January 11, 2015 Author Report Share Posted January 11, 2015 Hey man it worked no more line breaks in this instance so thanks for that now the other Excel problem. My Excel treats this file like its a txt File Instead of CSV file now why is that? EDIT: I just noticed my File gets saved as ANSI Format instead of UTF-8 can i change that when Ubot saves the file? Quote Link to post Share on other sites
dyvel 20 Posted January 11, 2015 Report Share Posted January 11, 2015 Try and change the separator from a comma to a semicolon ; in from the topmenu -> bot -> your bot propertiesThe csv I have attached imported without errors into my excel Walgreens.csv Quote Link to post Share on other sites
itexspert 47 Posted January 11, 2015 Author Report Share Posted January 11, 2015 Thanks man you solved my problem,i hope i can help you with your issues if you have any! Best Regards! 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.