Compare complete rows of two datatables

Hi all,

Normally I can find the anwers on the forum for all my questions, but for this particular question I could not find it.

I have two excel files that I put into datatables.
Both of the files have values in columns A:O.
There is not 1 column that makes a row unique, it is the combination of all columns together.

I would like to check from DT1, for every row, whether that row is found in DT2.
If not then that row needs to be saved in DT3.

I started with For Each Row, but I got completely stuck.

Hope you can help me.

Kind regards,

Jelmer

Hi

Welcome to uipath forum

Hope this expression would help you resolve this

Common Values

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

UnCommon Values

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

Cheers @jbode

2 Likes

Thanks! It works :slight_smile: I got first the following error… “AsEnumerable is not a member” → But luckily that was easily fixed :slight_smile:

Glad

Happy automation @jbode

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