Workbook.Combine

Workbook.Combine method

Combines another Workbook object.

public void Combine(Workbook secondWorkbook)
ParameterTypeDescription
secondWorkbookWorkbookAnother Workbook object.

Remarks

Merge Excel, ODS , CSV and other files to one file.

Examples

using System;
using Aspose.Cells;

namespace AsposeCellsExamples
{
    public class WorkbookMethodCombineWithWorkbookDemo
    {
        public static void Run()
        {
            // Create source workbook
            Workbook sourceWorkbook = new Workbook();
            sourceWorkbook.Worksheets[0].Cells["A1"].PutValue("Source Data");

            // Create destination workbook
            Workbook destWorkbook = new Workbook(FileFormatType.Xlsx);
            destWorkbook.Worksheets[0].Cells["B2"].PutValue("Destination Data");

            // Combine the workbooks
            destWorkbook.Combine(sourceWorkbook);

            // Save the combined workbook
            destWorkbook.Save("CombinedWorkbook.xlsx", SaveFormat.Xlsx);
        }
    }
}

See Also