Compare two datatable and update the first datatable and write to same excel

Hi everyone,

My requirement is i have two excels main excel tracker with 1000’s of data with multiple of columns
2.second excel extracted from mail table with max 6 columns with max 20 rows

I need to compare two datatables after using read range and for three columns which are similar in both excels i.e., paperno. , company name and designation

if these three columns matches i need to update start date ,end date and remarks values from matched columns in excel 2 /datatable2 to the main excel tracker/datatable1 using write range

I tried using for each loop and filter datatable but its time consuming so searching for alternate solutions

Any expert suggestions @Palaniyappan @Yoichi @Rahul_Unnikrishnan @jack.chan
Thanks in advance

1 Like


Have a view on this thread for multiple methods to do with datatable

Let us know if you are facing any further issues

Cheers @kavya.s16

@Palaniyappan thanks , but can u tell me how to compare two datatables for 3 particular columns

Compare two Datatables

Use a assign activity like this

For Common Values

dt = dt1.AsEnumerable().Intersect(dt2.AsEnumerable(),System.Data.DataRowComparer.Default).CopyToDataTable

  • For UnCommon Values*

dt = dt1.AsEnumerable().Except(dt2.AsEnumerable(),System.Data.DataRowComparer.Default).CopyToDataTable