How to consolidation data in single variable from excel multiple sheets. Sheets can be dynamic.
Please help me out through loop, how can i consolidate
If the columns from all the sheets are same, then only you can combine all the sheets into a single datatable object.
-
Build a master datatable with desired column format to consolidate all sheets
-
Loop through all sheets of workbook
-
Read each sheet range into a datatable
-
Loop through the datatable and add data rows to your consolidated master datatable
Make sure that the column formats and datatypes should match.
Could you share pls sample