Logic Suggestion Excel

Mods.xlsx (10.0 KB)
Master.xlsx (10.1 KB)

I have two excel files MODS and MASTER.

Step 1: I need to open MODS
Step 2: Look for “ID” column in MODS and search them in MASTER
Step 3 : If data is found in MASTER, delete the whole row from the MASTER file.

For example below rows must get deleted from the MASTER file
image

Please help with this logic, a xaml would be much appreciated, and there can be 500 such rows

@shikharno.7

You want to directly do it on excel?

If so read the first data into datatble then loop and use find/replace…if found then use delete rows

Else you can read both data into datatable and use linq to remove the data

Cheers

Hi @Anil_G , can you help me with the linq query please?

@shikharno.7

Use assign

dt2 = Dt2.AsEnumerable.Where(function(x) dt1.AsEnumerable.Any(function(y) y("ID").ToString.Equals(x("MasterId").ToString))).CopyToDataTable

Cheers

Hi @shikharno.7

=> Read Range Workbook
image
Output-> modsDataTable

=> Read Range Workbook
image
Output-> masterDataTable

=> Ue below syntax in Assign:
masterDataTable = (From masterRow In masterDataTable.AsEnumerable() Where Not modsDataTable.AsEnumerable(). Any(Function(modsRow) modsRow("ID").ToString() = masterRow("ID").ToString()) Select masterRow).CopyToDataTable()

=> Write Range Workbook masterDataTable
image

Regards

@vrdabberu Thanks for taking out the time to answer my query, can you please send the xaml for my reference, please

Hi @shikharno.7

Sure.

Sequence87.xaml (9.6 KB)
Master.xlsx (10.3 KB)
Mods.xlsx (10.0 KB)

Output has been written in Master.xlsx in Sheet2.

Regards

1 Like

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