ExcelApplication can open and modify an existing spreadsheet. The new spreadsheet can either be saved to disk (overwriting the original file or saved with a new name) or streamed to the browser. This allows you to use a preset format for similar spreadsheets, rather than recreate the format for each.
Alternatively, use an ExcelWriter template.
All features in the original workbook - including macros, charts, PivotTables, and VBA - will be preserved in the new workbook.
How to Modify an Existing Spreadsheet
To modify an existing spreadsheet:
Create an instance of ExcelApplication:
Open an Excel workbook from a file path or a System.IO.Stream:
Or:
Return a Worksheet object:
Modify the worksheet. For example, add a cell value:
Save the modified file with a new name, or stream it to the client:
Or:
For more information on save options, see Output Options.