Intellipaat Back

Explore Courses Blog Tutorials Interview Questions
0 votes
in RPA by (5.3k points)

 there is 1 unmatched record in excel which i need to get as my output


1 Answer

0 votes
by (9.5k points)

I would suggest you to use either VB.NET or C# and using the Except command. you would need to add additional DLL references (System.Data.DataSetExtensions.dll and System.Core.dll) and namespaces (System.Linq).

The C# code then would be:

colOut = col1.AsEnumerable().Except(col2.AsEnumerable(), DataRowComparer.Default).CopyToDataTable();

...where col1 and col2 are input collections and colOut is an output collection.

Mind you that you that the code above will find you rows from col1 that are not present in col2, to find rows from col2 that are not present in col1 you will either have to switch the inputs and run it again or tweak the code some more.

Browse Categories