Add column to csv

Hi guys

I have a csv file and I would like to add a column with the same value for all lines.
Do you have proposals ?

Thank you

@ali_sd,

Read CSV file into a datatable, then add a datacolumn to that table, then using a foreach row activity update the column value for all the rows, then write that datatable back to the csv file.

1 Like

Hi
welcome back to uipath community
hope these steps would help you on that
–use READ CSV FILE activity and get the output with a variable of type datatable named dt
–now use ADD DATA COLUMN activity and mention the datatable name as input and the column name we want to add atlast
–now use FOR EACH ROW loop and pass the above variable dt as input
–inside the loop use a ASSIGN activity like this
row(“newcolumnname”) = row(“yourcolumnname”).ToString

–then next to this for each row loop use WRITE CSV FILE activity where pass this datatable as input and mention the csv file path

Cheers @ali_sd

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.