XDoc.Excel
Features
Tech Specs
How-to C#
Pricing

C# Excel Library
C# Excel - Merge Excel Documents in C#.NET


Provide C# Demo Codes for Merging and Appending Excel Document





RasterEdge C#.NET Excel document merging toolkit (XDoc.Excel) is designed to help .NET developers combine Excel document files created by different users to one Excel file. Thus, C#.NET Excel document merge library control can be counted as an efficient .NET doc solution for keeping Excel document files organized.

This C# .NET Excel document merging control is written in managed C# code and compatible with all .NET developing platforms, like ASP.NET web application and Windows Forms project. Using this Excel document concatenating library SDK, C# developers can easily merge and append one Excel document to another Excel document file, and choose to create a new Excel file in .NET class application.

Besides C#.NET Excel document merging function, XDoc.Excel, a professional third-party .NET document imaging toolkit, also offers other advanced Excel document page processing and manipulating functions, such as Excel page insertion, Excel page deleting, Excel document splitting, Excel page reordering and Excel page image and text extraction. Remarkably, all those C#.NET Excel document page processing functions can be implemented independently, without using any Adobe-related software.

Our .NET Excel SDK empowers C# programmers to easily merge and append Excel files with mature APIs. To be more specific, two or more input Excel documents can be merged and appended together according to its loading sequence, and then saved and output as a single Excel with user-defined location.


Combine and Merge Multiple Excel Files into One Using C#



This part illustrates how to combine three Excel files into a new file in C# application. You may also combine more Excel documents together.

String inputFilePath1 = Program.RootPath + "\\" + "1.xlsx";
String inputFilePath2 = Program.RootPath + "\\" + "2.xlsx";
String inputFilePath3 = Program.RootPath + "\\" + "3.xlsx";
String outputFilePath = Program.RootPath + "\\" + "Output.xlsx";
String[] inputFilePaths = new String[3] { inputFilePath1, inputFilePath2, inputFilePath3 };

// Combine three Excel files and output.
XLSXDocument.CombineDocument(inputFilePaths, outputFilePath);


Append Excel Document in C#



In addition, C# users can append a Excel file to the end of a current Excel document and combine to a single Excel file.

//  get XLSXDocument object from one file
String inputFilePath1 = Program.RootPath + "\\" + "1.xlsx";
XLSXDocument doc1 = new XLSXDocument(inputFilePath1);
//  get XLSXDocument object from another file
String inputFilePath2 = Program.RootPath + "\\" + "2.xlsx";
XLSXDocument doc2 = new XLSXDocument(inputFilePath2);

//  append the 2nd document
doc1.AppendDocument(doc2);

//  save the document
String outputFilePath = Program.RootPath + "\\" + "Output.xlsx";
doc1.Save(outputFilePath);