Writing multiple range data in one output sheet

Hi

I’ve created a bot which reads multiple CSV files, deserialize it’s data and write it in an output. But It’s only writing the data from first CSV only I have 2 sheets in the folder.

Is there any correction required ?

I’m not sure what you mean by deserialize. You don’t have to deserialize a CSV file. You just use the Read CSV activity. What you need to do is Read CSV for each file - merging into a finalDT after each Read CSV. Then Write Range finalDT to Excel.

Hi Naman,
Please try to test this workflow.
Excel_GetWorkbookSheets.zip (10.3 KB)

Cheers,

@jose.ordonez1

Hi Jose.

I checked your workflow, it’s correct. But I want to read multiple CSV files. And In your workflow it has only test with multiple worksheets.

Can I use merge data table activity to merge data from each CSV sheet ?

Regards
Naman

I tried to use this activity but I’m getting this error.

CSV files don’t have sheets. But yes, you Read CSV into tempDT then merge into finalDT, then Read CSV the next file into tempDT then merge into finalDT, repeat this loop for each file.

You have to initialize your finalDT. In the variables panel, put “New System.Data.DataTable” into its default.

Hi @Naman_Arora

  1. Use For Each File in Folder Activity (Filter- "*.csv")
  2. Use Read CSV Activity (Assign in DT_Temp)
  3. Use Merge Data Table Activity (DT_Temp in DT_Final)
  4. Use Write CSV Activity (Outside Loop)


*Assign DT_Final as New DataTable in variable pannel.


Hope it will helps you :slight_smile:
Cheers!!

Hi Neman,
Try this project.
Demo.zip (3.6 KB)

Hope it helps you!