Merge Data Table to update

I have two data tables.
Dt1 with only headers and Dt2 having data…(reading Dt2 without headers)
I want append dt2 data to dt1.

Merge Data Table is not working properly.

Thanks

maybe can can share more details on what is not working

When dt2 has the same column count, but different col names and dt2.Col1 shoul be placed on dt1.Col1… you can do:
For each row in dt2

  • Add datarow - RowArray = row.ItemArray

Hi @MEGHA_cs

If dt1 only has headers, dt2 only has data and if both of their skeletal structure are same, can you try using Append Range to append dt2 data to dt1 data?

Hope this helps,
Best Regards.

Hi,

Another approach:

First copy dt2 to some datatable (let’s say dtResult)
Then rename column name of dtResult to column names of dt1 using ForEach

dtResult.Columns(idx).ColumnName = currentItem.ColumnName

Finally, copy dtResult to dt1.

Regards,

Hi @MEGHA_cs

You can iterate through each row in Dt2 using the For Each Row activity in UiPath Studio. Within the loop, you can use the Add Data Row activity to add each row from Dt2 to Dt1 as a new row. Make sure to configure the Add Data Row activity to append the data to Dt1 and preserve the column structure.

Thanks!!

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