New to Telerik Document Processing? Start a free 30-day trial
Appending a Worksheet to an Existing XLSX with RadSpreadStreamProcessing
Updated on Nov 19, 2026
Environment
| Version | Product | Author |
|---|---|---|
| 2026.3.1027 | RadSpreadStreamProcessing | Yoan Karamanov |
Description
RadSpreadStreamProcessing lets you add a worksheet to an existing XLSX workbook with SpreadExportMode.Append. The existing stream must support seeking, reading, and writing.
This knowledge base article also answers the following questions:
- How can I append a worksheet without replacing existing worksheets?
- Which stream capabilities does
SpreadExportMode.Appendrequire? - How can I check existing worksheet names before I append a sheet?
Solution
To append a worksheet, follow these steps:
- Open the existing XLSX file with
FileMode.OpenandFileAccess.ReadWrite. - Create the workbook exporter with
SpreadDocumentFormat.XlsxandSpreadExportMode.Append. - Create a worksheet with a unique name, then dispose the worksheet and workbook exporters to finish writing.
The following example adds a Summary worksheet to an existing workbook:
csharp
using System.IO;
using Telerik.Documents.SpreadsheetStreaming;
string filePath = "existing-workbook.xlsx";
string worksheetName = "Summary";
using (FileStream stream = File.Open(
filePath,
FileMode.Open,
FileAccess.ReadWrite))
using (Telerik.Documents.SpreadsheetStreaming.IWorkbookExporter workbook =
Telerik.Documents.SpreadsheetStreaming.SpreadExporter.CreateWorkbookExporter(
Telerik.Documents.SpreadsheetStreaming.SpreadDocumentFormat.Xlsx,
stream,
Telerik.Documents.SpreadsheetStreaming.SpreadExportMode.Append))
{
using (IWorksheetExporter worksheet =
workbook.CreateWorksheetExporter(worksheetName))
{
using (IRowExporter row = worksheet.CreateRowExporter())
{
using (ICellExporter cell = row.CreateCellExporter())
{
cell.SetValue("Quarter");
}
using (ICellExporter cell = row.CreateCellExporter())
{
cell.SetValue("Total");
}
}
using (IRowExporter row = worksheet.CreateRowExporter())
{
using (ICellExporter cell = row.CreateCellExporter())
{
cell.SetValue("Q1");
}
using (ICellExporter cell = row.CreateCellExporter())
{
cell.SetValue(1250);
}
}
}
}
Key Points
Before you append a worksheet, check these requirements:
- Open an existing XLSX file with a stream that supports seeking, reading, and writing.
- Call
IWorkbookExporter.GetSheetInfos()and compare the proposed name with each returnedSheetInfo.Name.CreateWorksheetExporter()throws anArgumentExceptionwhen the name already exists. - Dispose
IWorksheetExporterbeforeIWorkbookExporter. The workbook exporter finalizes the XLSX package when you dispose it.
The default
SpreadExportMode.Createmode replaces workbook content in the stream. UseSpreadExportMode.Appendto keep existing worksheets.