Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Combine Multiple Excel Files into One using C#
// Open the first excel file.
Workbook SourceBook1 = new Workbook("Excel A.xlsx");
// Open the second excel file.
Workbook SourceBook2 = new Workbook("Excel B.xlsx");
// Open the third excel file.
Workbook SourceBook3 = new Workbook("Excel C.xlsx");
// Copy worksheets of second Excel file to the first workbook.
SourceBook1.Combine(SourceBook2);
// Copy worksheets of third Excel file to the first workbook.
SourceBook1.Combine(SourceBook3);
// Save the updated first excel file as a new file.
SourceBook1.Save("CombinedFile.xlsx");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment