Q) Compare Two Datatable


Compare two data tables
I want to extract data that is not the same.

If you know how,
I ask for your help.

How many columns do you want to compare? Or all the columns?

If you compare two columns only, you can use activity “Join Data Tables” to check the difference and similarity. You may have to compare columns individually if you want to compare the whole datatable.

I’d like to compare all the columns


The following will help you.

arrDr = dt2.AsEnumerable.Except(dt1.AsEnumerable,DataRowComparer.Default).ToArray

arrDr is DataRow[] type.



Let me ask you one more question.

Only values that are not the same
Is there a way to extract it?

Ex) 3,3,3,4,4,4,5,5,5


Only values that are not the same
Is there a way to extract it?

Can you elaborate?
Is “3,3,3,4,4,4,5,5,5” expected output?


After comparing the two data tables,
You must find a location for an unequal value.

I want to extract only the values that are not the same, is it possible?

On the Excel screen that I uploaded as an example,
The price I want is
I want to extract only the separate values of 3, 3, 4, 4, 5, 5.


How about the following expression?

 String.Join(",",dtResult.AsEnumerable.SelectMany(Function(r) r.ItemArray))


Thank you.

I want to use Uipath freely like you, so what kind of study should I do?


I think it’s better to learn by UiPath Academy, first. However, the above expression is technique of VB.net rather than UiPath. So, next learn VB.net or C# deeper. The following topic might also help you.


1 Like

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