Microsoft® Excel File Merging via .NET

Combine 2 or more Excel files in a single spreadsheet using C# code

 

.NET Excel Library provides multiple ways to combine workbooks with various types of content like formulas, data, images, charts and so on into a single spreadsheet file. Supported file formats include XLS, XLSX, XLSB, XLT, XLTX, XLTM, ODS, CSV, TSV and more.

Combine Excel Files with Images and Charts

The simplest way to combine 2 Excel files having images & charts is by calling the Workbook.Combine method. It allows to merge Excel files of similar type into a single spreadsheet.

C# Code to Combine Excel Files

Merge Multiple Excel Files

CellsHelper.MergeFiles method supports merging data, style and formulas of an Excel file to a new spreadsheet of same format. It is an efficient way to merge several files while using caching.

C# Code to Merge Several Excel Files

Merge Excel Files by Copying Worksheets

Worksheet.Copy can used to copy data and formatting from a source worksheet to another worksheet within or between workbooks. The method takes the source worksheet object as a parameter.

C# Code to Copy Worksheets Across Excel Files

Other Supported Merging Formats

Using C#, One can also merge many other file formats including.

CSV (Comma Separated Values)
HTML (Hyper Text Markup Language)
MHTML (Web Page Archive Format)
ODS (OpenDocument Spreadsheet File)
TSV (Tab-Separated Values)
TXT (Text Document)
XLS (Excel Binary Format)
XLSB (Binary Excel Workbook File)
XLSM (Spreadsheet File)
XLSX (OOXML Excel File)
XLT (Microsoft Excel Template)
XLTM (Excel Macro-enabled Template)