Compare the data from 2 excel file and find the differences

i want to compare the data and find the differences and save it into a new sheet showing the anually and quarterly data.

i want it to be format in a way in the new excel sheet the first row will be the NRIC then the second row ill be the anually data followed by quarterly data

Hi @Ryan_Lee,

The issue here is, there’s a mismatch in column Names in both the excel sheets, if you can match the header names in both the excel sheets then you can do the following:

  • Read the excel sheets as DataTable.
  • Use the except method to compare the DataTables, this returns the difference between the 2 dataTables, eg) dt1.AsEnumerable().Except(dt2.AsEnumerable)
  • The resultant of this will produce the difference between the 2 dataTables.

This method purely depends on the column headers being the same in both the dataTables, you may encounter some exceptions especially in this part, since the read range considers the first row as the header, the rest of the sub headers will be considered as data in a DataRow.
image

can u show me an example or send me the solution