How to read multiple csv one by one from a folder and for each csv get the file name and write the file name in each csv

Hi i am trying to read all csv from a directory and for each csv i want to write each file name to the column a1 to each csv

So to retrieve all CSV from a directory you can use Get Directory with the “*.csv” filter.

You can then use a for each loop for this will give you the file names.

1 Like

i have got the files name but not able to write them into the same csv, for example, test.csv i want to take the file name and write it to the column a1 to the same Test.csv

when the file is open, you cant do it, you store it in a different name temporarily, later delete the test.csv and then save the temp file as test.csv, hope that helps.

1 Like

Hi @TimK,

Use can you path.getfilename(yourfilewithfullpath)
using this you can get your file name then assign this name to your column one by one using a for each row you can get the file name and just assign it to the column name variable.

Cheers

1 Like