How to merge datatables obtained from a loop which gets datatable corresponding to each worksheet (having same headers) in an excel

Hi

I am new to UiPath and currently working on a problem, to combine all Sheets (having same headers) into one Sheet.

For this I have read all Sheets using Get Workbook Sheets, and then have looped them to read the datatable from each sheet, using ForeEach. Check Screenshots below.

Now I want to combine all these datatables into one datatable, how can I do it.

image

image

Thanks in advance.

Regards
Ankit

Please check https://activities.uipath.com/docs/merge-data-table

Hi @ankswe

If the column headers are somewhat similar or each table has some matching columns then you can use merge datatable activity to merge the tables.If the tables has even one matching column then you can set MissingSchemaAction Property to Add in the properties pane.

Hi Amarasto

All sheets have same columns. But what it do is instead of appending the data from second sheet onwards, it is actually overwritting it.

So, if say first sheet has 2 rows, it is overwritten by data of second sheet which has 3 rows, and this continues.

Regards
Ankit

Hey @ankswe,

Have You tried Append Datatable Activity?

Hello Ankit

Check what datatable you are using in source and destination column

You would need a merge datatble activity for each time you wish to merge a datatable

Eg:
DT1 (from sheet 1) as Source and DT_Master as destination
DT2(from sheet2) as sSOurce and DT_Master as destination

and so on

Make sure Missing schema action in properties of Merge data table is set to add

Hello neonova,

I am trying exactly the same you mentioned but still I am facing the same issue which Ankit was facing. Merge datatable activity is actually overriding the destination data table after every iteration instead of merging the source data table .
Thanks!!!