Excel 1 : col name: NAME
ROW 1 : ABC
ROW 2 : DEF
ROW 3 : GHI
Excel 2 : col name: NAME
ROW 1 : ABC
ROW 2 : DEF
ROW 3 : GHI
Row 4 : XYZ
I need to read both excel and display extra row which is appearing in Excel2 in console/message box
Please go through this video.
Read both Excel files into two DataTables:
dtExcel1 = Read Range from Excel1
dtExcel2 = Read Range from Excel2
Then use this linq in an Assign activity to find the extra rows in Excel2 that are not in Excel1
extraRows = dtExcel2.AsEnumerable().
Where(Function(row2) Not dtExcel1.AsEnumerable().
Any(Function(row1) row1(“NAME”).ToString.Trim.Equals(row2(“NAME”).ToString.Trim))).
Select(Function(r) r(“NAME”).ToString.Trim).ToList()
Use Message Box → String.Join(Environment.NewLine, extraRows)
This way, if Excel2 has a value like XYZ that doesn’t exist in Excel1, the message box will display:
XYZ
If this is needful then mark it as SOLUTION
Happy Automation
Could you please share what you have tried already and anywhere you stuck?
@Nidhi_Kowalli If you prefer not to use LinQ, you can easily merge those dataTables and filter out the unusual entries to display on your console.
ExcelAuto.xaml (9.9 KB)
TestDoc.xlsx (9.4 KB)
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.