CSV Export

The data can be exported to CSV with an API call, or using the right-click context menu on the Grid.

This page covers CSV-specific features. For information on how to control what data is included in the export and to format/transform the data as it is exported, see the Export documentation.


  • gridOptions.suppressCsvExport: set this Grid Property to true to disable CSV export
  • exportDataAsCsv(params): download a CSV file to the user's computer.
  • getDataAsCsv(params): return a CSV string.

The params object can contain all the common export options, as well as these CSV-specific options:

suppressQuotes By default cell values are encoded according to CSV format rules: values are wrapped in double quotes, and any double quotes within the values are escaped, so my"value becomes "my""value". Pass true to insert the value into the CSV file without escaping. It is your responsibility to ensure that no cells contain the columnSeparator character.
columnSeparator Delimiter to insert between cell values. Defaults to comma.

Appending header and footer content

The recommended way to append header and footer content is by passing an array of ExcelCell objects to customHeader or customFooter, as described in the Export documentation. This ensures that your header content is correctly escaped, and if your application also exports Excel data you can use the same data for both exports.

For compatibility with earlier versions of the Grid you can also pass a string, which will be inserted into the CSV file without any processing. You are responsible for formatting the string according to the CSV standard.

Example: CSV Export Options

  • suppressQuotes and columnSeparator have the effects documented above. Use the "api.getTextAsCsv()" button to see their effect, because changing their default values will prevent the file from opening properly in Excel
  • With customHeader=ExcelCell[][], custom content will be inserted containing commas and quotes. These commas and quotes will be visible when opened in Excel because they have been escaped properly.
  • Setting customHeader=string causes a string to be inserted into the CSV file without any processing, and without being affected by suppressQuotes and columnSeparator. It contains commas and quotes what will not be visible in Excel.