CSV Export

The data can be exported to CSV with an API call. You have two options, let the grid do the export if the browser is modern and it is allowed, or you get the grid to return you the CSV string and your application is responsible for the export (some older browsers will require you to send the data to the server and do an old school 'file download' from the server).

If you are looking to export your data formatted for Excel use the ag-Grid Enterprise feature Excel Export. If you want to disable CSV export, you can set the property suppressCsvExport = true in your gridOptions

The API methods are as follows:

  • exportDataAsCsv(params): Does the full export.
  • getDataAsCsv(params): Returns the CSV data for export.

Each of these methods takes a an optional params object that can take the following:

  • skipHeader: Set to true if you don't want to first line to be the column header names.
  • columnGroups: Set to true to include header column groupings.
  • skipGroups: Set to true to skip row group headers and footers if grouping rows. No impact if not grouping rows.
  • skipFooters: Set to true to skip footers only if grouping. No impact if not grouping or if not using footers in grouping.
  • suppressQuotes: Set to true to not use double quotes between values.
  • fileName: String to use as the file name. If missing, the file name 'export.csv' will be used.
  • customHeader: If you want to put some text at the top of the csv file, stick it here. You will need to include '\n' at the end, or many '\n' if you want the header to span lines.
  • customFooter: Same as customHeader, but for the end of the file.
  • allColumns: If true, all columns will be exported in the order they appear in columnDefs. Otherwise only the columns currently showing the in grid, and in that order, are exported.
  • onlySelected: Only export selected rows.
  • onlySelectedAllPages: Only export selected rows including other pages (only makes sense when using pagination).
  • columnSeparator: The column separator. Defaults to comma.
  • columnKeys: Provide a list (an array) of column keys if you want to export specific columns.
  • shouldRowBeSkipped: Allows you to skip entire rows from the export.
  • processCellCallback: Allows you to process (typically format) cells for the CSV.
  • processHeaderCallback: Allows you to create custom header values for the export.


This callback allows you to entirely skip a row to be exported. The example below has an option 'Skip Group R' which will entirely skip all the rows which Group=R.

The callback params has the following attributes: node, api, context.


This callback allows you to format the cells for the export. The example below has an option 'Use Cell Callback' which puts all the items into upper case. This can be useful if, for example, you need to format date cells to be read by Excel.

The callback params has the following attributes: value, node, column, api, columnApi, context.


If you don't like the header names the grid provides, then you can provide your own header names. Maybe you have grouped columns and you want to include the columns parent groups.

The callback params has the following attributes: column, api, columnApi, context.

What Gets Exported

The same data that is in the grid gets exported, but none of the GUI representation of the data will be. What this means is:

  • The raw values, and not the result of cell renderer, will get used, meaning:
    • Cell Renderers will NOT be used.
    • Value Getters will be used.
    • Cell Formatters will NOT be used (use processCellCallback instead).
  • If row grouping, all data will be exported regardless of groups open or closed.
  • If row grouping with footers (groupIncludeFooter=true) the footers will NOT be used - this is a GUI addition that happens for displaying the data in the grid.


The example below shows the export in action. Notice the following:

  • Filtered rows are not included in the export.
  • The sort order is maintained in the export.
  • The order of the columns is maintained in the export.
  • Only visible columns are export.
  • Value getters are used to work out the value to export (the 'Group' col in the example below uses a value getter to take the first letter of the country name)
  • Aggregated values are exported.
  • For groups, the first exported value (column) will always have the group key.
  • Heading groups are exported as part of the csv.

Export to CSV with iPad

It is not possible to download files directly from JavaScript to an iPad. This is a restriction of iOS and not something wrong with ag-Grid. For this reason, the download links in the context menu are removed when running on iPad. If you do want to download on iPad, then it is recommended you use the api function getDataAsCsv() to get the export data and then send this to the server to allow building an endpoint for doing the download.