Created
January 14, 2021 05:57
-
-
Save conholdate-gists/93009b8b055b086b90ee581d40ad5b73 to your computer and use it in GitHub Desktop.
Combine Multiple Excel Files into One using C#
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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