Spreadsheet .NET > Tutorial > Save workbook to a stream or byte array

The following example shows you how to generate an XLSX workbook in memory. The GetBytes method returns the complete file as a byte array, which is convenient in web applications where the workbook is sent to the client as a download and never stored on disk.

C# example
VB example

The Save method also accepts any System.IO.Stream, so the workbook can be written directly to a MemoryStream, a response stream or any other destination.

C# example
VB example

Need help? Ask our developers: