Loading and saving workbook on Linux

24 Jul 20261 minute to read

Prerequisites

NOTE

Starting with v16.2.0.x, if you reference Syncfusion® assemblies from trial setup or from the NuGet feed, you also have to add the Syncfusion.Licensing assembly reference and include a license key in your projects. Please refer to this link to know about registering the Syncfusion® license key in your applications to use our components.

Opening an existing workbook

You can open an existing workbook by using the overloads of Open methods of IWorkbooks interface.

// Create a new instance of ExcelEngine
using (ExcelEngine excelEngine = new ExcelEngine())
{
    // Initialize IApplication
    IApplication application = excelEngine.Excel;

    // Open an existing workbook
    IWorkbook workbook = application.Workbooks.Open("Sample.xlsx");
}

Saving an Excel workbook

You can also save the created or manipulated workbook using overloads of SaveAs methods.

// Create a new instance of ExcelEngine
using (ExcelEngine excelEngine = new ExcelEngine())
{
    // Initialize IApplication
    IApplication application = excelEngine.Excel;

    // Open an existing workbook
    IWorkbook workbook = application.Workbooks.Open("Sample.xlsx");

    // To-Do: some manipulation

    // Set the version of the workbook
    workbook.Version = ExcelVersion.Xlsx;

    // Save the workbook
    workbook.SaveAs("Output.xlsx");
}

See Also