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.
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.
(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()