Hi guys please help me, How to create new CSV file for every table data scraping from web?
for now i can scrape table from web and write to csv, but the data always replace in same collumn and same file, how to create new csv file for each data from web?
Thankyouu
Hi @raditiyoyo
Welcome to the community.
You can set up unique name to file like āDataā + Now.ToString(āddMMyyyy_HHmmssā) +ā.csvā
When you directly specify this path in Write CSV activity, if it throws an exception like: āExpression Activity type āVisualBasicValue`1ā requires compilation in order to run. Please ensure that the workflow has been compiled.ā
Then try using an Invoke Code:
The Code inside Invoke Code:
filePathName = "Data/Output/CSV_Data_" + DateTime.Now.ToString(āddMMyyyy_HHmmssā) +ā.csvā
The Invoke Code Arguments:
The Output:
As you can see below, Separate CSV files are generated everytime.
You try any type of dynamic naming convention, to make the file names unique.
If this solves your issue, Do mark it as a solution.
Happy Automation
still didnt work, In my main sequence there is a read range workbook with an excel file but the file is different from the destination file for write to csv, do they have to be the same?
Not necessary. The solution i gave, would create a new file entirely. If there is a file that exists with same name, then it would override, But that is not possible because new file Name is created every time before the Write CSV activity.
Could you tell me what is the exact workflow you are expecting?
- data scraping from website (table extract)
- input data to csv or excel
- looping continuously and create new file for each data
This is confusing to me:
You will Write the Extracted data to CSV and then Loop through each Data to create new files again?
Looping through what exactly?