Saving to CSV in separate rows?

Hopefully a simple question here:

I want a basic scraping utility to save the first five search results to individual lines of a CSV file.

Is it possible to do this with !csvLine, or do I need !csvSaveArray?

This simple code almost works - it loads the CSV, identifies the target, and stores it:

csvReadArray | listfile.csv | MyCSVArray
storeAttribute | xpath=//*[@id="__next"]/div/div[2]/div/div/div[2]/main/section/div[2]/article/div[2]/div/div/h3/a@href | !csvLine
csvSave | listfile

Only one problem: If I do additional instances of !csvLine it saves all the values on the same line (row).

So “link1” + “link2” + “link3” become become “link1,link2,link3”

I want them in separate rows (lines).

Unless there is a way to get !csvLine to save as seperate lines, it seems like what I need to do is use saveCsvArray to save each value as an individual array with subsequent line numbers.

Howeverrrrrr,… the command documentation for csvSaveArray is laughable (like two sentences, no example) and it references a Demo macro ( DemoCsvSaveArray) that literally does not exist.

Can someone please explain how to do this with either !csvLine or !csvSaveArray?

Thank you!

Thanks for that hint. This was a typo. It should read:"csvSaveArray example: See the DemoCsvReadArray demo macro that is installed with UI.Vision RPA. At the beginning this macro uses csvSaveArray to create a CSV file that is then used as input for csvReadArray.

1 Like

To answer your main question: If you want separte lines, add a csvSave | listfile whenever you want a new line to start.

  • Every store | x | !csvLine is added to the existing CSV row (as you noticed)

  • Every executed csvSave command starts a new CSV row.

Thank you I will check this out

Fantastic, thank you. I will try this and mark as solution if it works!