I have 6 .csv files in a folder and a workbook template with 6 sheets. I need to read each csv file and write into the respective sheet. For eg: Read 1st csv file and write in 1st of workbook. Read second file and write in 2nd sheet of work book and so on. How to do this. Can any one had idea.
You can use a assign say Files a string array with Directory.Getfiles(“YourPath”,“*.csv”), now use a for each loop pass the variable files in it, post that use read csv activity and read every item that is your file, post that use write range to write in the workbook, you can use a switch case with input argument as file name on the basis of which you can decide the sheet name.
You can try like this
- Use For each file in folder and pass your path and set as .csv
- So it will loop for all the files
- After use Read CSV and write range to write in the excel file.
Whether the Sheets in the workbook and the file name of CSV are same ?
retrieve all csv file paths Directory.GetFiles(YourFolderPath, “*.csv”)
use the read csv activity - retruning a datatable
write it to Excel with write range activity
in case of CSV file needs some special handling let us know
Thank you, I tried this
Thank you fir your effort
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.