Compare two columns from two excel and update values to the first row from the duplicate rows

Hello all,

I need to compare two columns A and B from two different excel files, if the values are matched get the value from column C in the second file of that particular matched row and update this value in the column C in the first file in the first row of duplicate rows with out removing duplicate rows.

hi @s.panuganti

Could you please refer below article for similar question already posted in UiPath Forum.

Please watch some videos related to excel activites

Thanks,
AM

Hi @s.panuganti ,

Welcome to the UiPath forum.
It is a little hard to provide a proper solution without test data, but I’ll try my best.

(From row in dt1.AsEnumerable()
Let chk = dt2.AsEnumerable().Where(Function(w) 
w("A").ToString.Trim.Equals(row("A").ToString.Trim) And 
w("B").ToString.Trim.Equals(row("B").ToString.Trim).ToArray()
Let ra = new object(){row(0), row(1), If(chk.Count()>0,chk.First(), "")}
Select dt_result.Rows.Add(ra)).CopyToDataTable()

If you would be so kind as to include a test data, I can create a sequence for you.

Kind Regards,
Ashwin A.K

1 Like

No, none of them are supporting me. Please give few more suggestions.

@s.panuganti

maybe the definition of duplicates are to respecify (1, n, All Cols)

We do understand:

input:
grafik

result:
grafik

Flow:

for each typeargument: datarow

FirstRows:

(From d In dt1.AsEnumerable
Group d By k1=d(0).toString.Trim, k2=d(1).toString.Trim Into grp=Group
Select g=grp.First()).toList

item(2) =

(From d In dt2.AsEnumerable
Where d(0).toString.Trim.Equals(item(0).toString.Trim)
Where d(1).toString.Trim.Equals(item(1).toString.Trim)
Select c=d(2)).FirstOrDefault()

Find starter help here:
GetValueFromMatch_2Tabs1Col_UpdateLeftFirstDupOnly.xaml (12.8 KB)