Spreadsheet .NET > Tutorial > Export worksheet to CSV

The following example shows you how to export the whole workbook to CSV format with a single call. The GetCsv method writes every worksheet, each preceded by its name, and quotes the fields that contain a comma, a quotation mark or a line break, as specified by RFC 4180.

C# example
VB example

The following example exports a single worksheet by iterating over all populated cells, which is what you need when you want to control the layout of the output yourself.

C# example
VB example

Need help? Ask our developers: