How to compare two and create a new file with data matching the criteria

I need to compare 2 excel file. E.g -employee details, Manager Details… have to look for the manager code in employee details file and get the respective mail id of the same (Manager code will be available under employee code in employee details file) and store in seperate file…

Hi @srivid_it , Welcome to UiPath Forum.

please can you show me the same column which should available in both the tables.

pls follow the steps:-

  1. Excel application scope
  2. Inside excel application scope take 2 read range activities. 1 read range for Employee Details(variable DT1) next one for Manager Details(variable DT2)
    → build DataTable activity here build a table which you want as a output columns.(Manager code) in properties output create one variable (DT3)
  3. Take ForEach in DataTable
  4. Inside ForEach read the first table Employee Details (DT1)
  5. Choose the column which is match with the another table column. CurrentRow("ColumnName").ToString
  6. and take another ForEach in DataTable to read Managr Details (DT2)
  7. Select the column in Manager Details matched with the Employee Details table column. CurrentRow2("ColumnName2").ToString
  8. Take If condition




  1. Add data row in properties in array {ManagerCode} in properties DT table mention (DT3)

  2. ExcelApplicationScope

  3. Write range

I hope this will work. if need any asistance please let me know


Hi @srivid_it
you can try linq query for this around

  1. Assuming that employee details : dt1

Manager Details : dt2

use the linq query

array_data= (From r1 in dt1.AsEnumerable

From r2 in dt2.AsEnumerable

Where r1(“manager code”).ToString.Equals(r2(“manager code”).ToString)

Select r(“mail id”).ToString).ToArray()

Try this way

Nived N

Hi Thirunani
Thank you…it works.

1 Like

Cheers @srivid_it


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