Add Data Column With Values to existing data table

I have a query related to excel.
I have two sheets in my excel having the same data columns but the last one is different and I need to add the last data column on sheet2 to sheet1 with the values, without using it for each loop.

@PRASHANT_GABHANE

You can use Assign activity and write as below

dt1.Rows(dt1.Rows.Count-1).Items(“ColumnName”) = dt2.Rows(dt2.Rows.Count-1).Items(“ColumnName”)

Check below for your reference

Reference

Hope this may help you

Thanks

Hi @Srini84

Can’t we do it without For each loop?

Thanks,
Prashant

Hi,

Hope the following helps you.

dt1= dt1.AsEnumerable.Select(Function(r,i)
r("AddedColumn")=dt2.Rows(i).item("AddedColumn")
Return r
End Function).CopyToDataTable

Regards,

1 Like

Hi @Yoichi

Thank you so much!

1 Like