Loading and saving workbook on Linux

10 Nov 20251 minute to read

Opening an existing workbook

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

//Creates a new instance for ExcelEngine
ExcelEngine excelEngine = new ExcelEngine();

//Initialize IApplication
IApplication application = excelEngine.Excel;

//A existing workbook is opened.   
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.

//Creates a new instance for ExcelEngine
ExcelEngine excelEngine = new ExcelEngine();

//Initialize IApplication
IApplication application = excelEngine.Excel;

//A existing workbook is opened.
IWorkbook workbook = application.Workbooks.Open("Sample.xlsx");

//To-Do some manipulation
//To-Do some manipulation

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

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