Excel comparison in faster way

Hi Team,

I have two different excel sheet, from XL1 I have to compare employee name with XL2.
If there is a match with XL1 Emp name with XL2 emp name. Then again I have to check work
date from XL1 whether it is falling in between XL2 allocation start & allocation end date or not, If yes then I have to update work hours from XL1 & Employee Id in seperate collumn created in the XL1 at the end.

The same I have created through for each each, but due to huge data around 5k in the xl2 master data, it is taking long time to process.

Request the team if there is any way to process faster that comparing row wise in for each loop.

For reference, I have attached both XL1 & XL2 with sample data.


XL1.xlsx (11.8 KB)

XL2.xlsx (8.9 KB)


You could try to query your excel documents instead via OLEDB.
Take a look at this thread Excel OLEDB connection

You could also take a look at linq LINQ Tutorials for handling large datatables.