Merging multiple excel files

I have multiple files where the need to merge all in separate excel in one sheet, I am able to merge all files in a single sheet, but I want to copy data with all sheets headers. As it’s copying first sheet header with data for rest of the sheets it’s copying data not copying header.

Hi @balkishan

Do it in a loop,

For Each File in FileList
{
-> Excel Application Scope
  -> Read Range (make sure Include Headers is checked)
   -> Append Range (output of step2) to new Excel
} 

Regards,
Karthik Byggari

@KarthikByggari I did that bro, it’s copying the data and merge all excel sheets data in single sheet, but it copying the first sheet headers but rest of the files only data not headers.

Hi @balkishan,
Have you already read this one by @Lahiru.Fernando?


Hope this helps. THanks :slight_smile:

In the Read Range Activity, uncheck the following option and try.

  • AddHeaders - When selected, the column headers from the specified spreadsheet range are also extracted. By default, this check box is not selected.

@Jan_Brian_Despi Already checked this one bro, My requirement is different.

@KarthikByggari tried not worked bro

Hi @balkishan

So you need to add headers of all the excel files in your output file one below the other. So to do that, I guess this type of flow is what you need.

  1. Have a loop iteration counter. If 1, do a write range to your output datasheet.
  2. If greater than one, get the row count of your output file to see how many rows are already there and add + 1 to it to get the next row.
  3. Do another write range to write the data back. For the range property, include the output row count you just got so that it will add it from there. Also make sure to add the “Add Headers” check box.

Does this help?


image

1 Like

@Lahiru.Fernando Exactly bro, Means I want to copying the complete sheet with headers. And same for every sheet in a single sheet.

Then I suggest,

Make sure Add Headers is included.

Take headers from data table into one data row and use two append activities. Please try and let me know.
Append range - for headers
Append range - for data table

1 Like

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