While dealing with data table operations, sometimes we might want to compare two data tables and get matched data
(From a In SourceDT.AsEnumerable Join b In Destination_Table.AsEnumerable On a(“Column_Name”).ToString Equals b(“Column_Name”).tostring Select a).CopyToDataTable.Select().CopyToDataTable().DefaultView.toTable(False,”Name”)
Replace “SourceDT” and “DestinationDT” with your required data tables and “Column_Name” with your required column name that you want to match with
Implementation using UIPATH:
Let us implement a workflow which takes two excel files as input and gives us matched data between those excel files as output
Drag Read Range(Here I have used workbook activity) activity and read “excel file1” and get datatable1
Drag Read Range(Here I have used workbook activity) activity and read “excel file2” and get datatable2
Drag “Assign” activity into the designer panel and fill it with the above-mentioned code.
Drag “MessageBox” activity to display the result.
(Note: Here I have used LINQ to display the DataTable instead of output Datatable)
Finally, Execute the workflow !!!
Click Here to download the source code
Hope it has helped you……..
2 thoughts on “How To Compare Two Excel Files Of The Same Format And Get Matched Data?”
Writing LINQ is going to difficult for me. Where do I learn and remember the LINQ ?
Please go through this…