C#: Online Guide
How To: excel SDK
File: Merge Excel Files
File: Merge Excel Files
Home ›› XDoc.Excel ›› C# Excel: Merge Excel Files

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.

Related .net document control helps:
asp.net pdf editor: EdgePDF: ASP.NET PDF Editor Web Control: Online view, annotate, redact, edit, process, convert PDF documents
asp.net mvc pdf editor: ASP.NET MVC PDF Viewer & Editor: view, annotate, redact, edit PDF document in C# ASP.NET MVC
asp.net document viewer c#: ASP.NET Document Viewer using C#: Open, View, Annotate, Redact, Convert document files in ASP.NET using C#, HTML5, JQuer...
asp.net sharepoint document viewer: ASP.NET SharePoint Document Viewer: view, annotate, redact documents in SharePoint
asp.net word document viewer: ASP.NET Office Word Document Viewer: view Word doc files online using C# in ASP.NET MVC web applications
asp.net document viewer: EdgeDoc:ASP.NET Document Viewer C# Control: Open, view, annotate, redact, convert documents online in C#, VB.NET, AS...
asp.net annotate pdf: ASP.NET Annotate PDF Control: annotate, comment, markup PDF document online using ASP.NET C#

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.

C# DLLs: Merge Excel Files

Add necessary references:










Using namespaces:

  using RasterEdge.Imaging.Basic;

  using RasterEdge.XDoc.Excel;

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

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