Comparing values from two data tables

Hello all,

i have an excel file that contains a column (“names”)
and i have an other data table 2 that i get with data scraping
i want to check if rows from “names” exist in the first row of the data table 2.

Any help Please!

You can use linq to quickly check. Do you want to simply know if any duplicates exist? Or do you want to get a list of duplicates?

@teyssir1

Welcome to the uipath community.

Use nested For Each Row activity.

              ForEach row1 in DT1
                     ForEach row2 in DT2
                           If row1("ColumnName").ToString = row2("ColumnName").ToString
1 Like

(from a in DT1 join b in DT2 on a (“names”).Tostring() equals b (0).Tostring() select a).CopyToDataTable

DT1-first Datatable
DT2-Second Datatabel

a(“names”)
b(0) is the first column

Output will be the matched Datatable

Hello,
Thank you for your answer
i have tested , it is only going through the first “for each row” withought executing the “for each row for the second DT”

thank you for you answer,
in fact i want to compare those two file.
the DT1 is smaller than the DT2
so for exp if DT1 contains only 4 rows i have to check if those 4 rows exist in the 4 first rows of DT2

thank you for you answer,
in fact i want to compare those two file.
the DT1 is smaller than the DT2
so for exp if DT1 contains only 4 rows i have to check if those 4 rows exist in the 4 first rows of DT2

1 Like