How to loop through files in a folder and put files in a new folder

please help

I have a folder, in the folder there is a CSV format file. I want to filter a CSV file to only take some data. then I want to convert the CSV file into an Excel file and put it in a new folder.

How do I do the above activity repeatedly with many and different CSV files?

Hi @Kia1

Try this



An error occurs, how to resolve it?


Give CurrentFile.ToString and check the updated code above


I have question

I already have a folder containing excel files that I haven’t converted. Now I want the data in the Excel file to be automatically copied to the Excel template file that I have. after the data is copied to the excel template file. The template file is sent directly to email from the data I have.

please help, how can the task flow be implemented using UiPath?

For Each File in Folder

  • Read CSV current file into datatable
  • Filter Data Table or other methods to get it down to the data you want
  • Write Range into Excel file in the other folder (you don’t write it then move it, just write it directly in the folder you want it in)