The grid data can be exported to CSV with an API call, or using the right-click context menu (Enterprise only) on the Grid.
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:
Value Getters will be used.
Cell styles are not exported.
If row grouping (Enterprise only):
All data will be exported regardless of whether groups are open in the UI.
processRowGroupCallback
to change this).groupIncludeFooter=True
) will NOT be exported - this is a GUI addition only.The CSV export will be enabled by default. If you want to disable it, you can set the property
suppressCsvExport = True
in yourgridOptions
.
The example below shows the default behaviour when exporting the grid’s data to CSV.
See the reference section below and the AG Grid docs for more details and examples of the options you can set for the CSV export.
This example shows how to exclude the headings on export and include hidden columns on export.
csvExportParams
(dict; optional): Object with properties to pass to the exportDataAsCsv() method. csvExportParams
is a dict with keys:
allColumns
(boolean; optional): If True, all columns will be exported in the order they appear in the columnDefs.
appendContent
(string; optional): Content to put at the bottom of the file export.
columnKeys
(list of strings; optional): Provide a list (an array) of column keys or Column objects if you want to export specific columns.
columnSeparator
(string; optional): Delimiter to insert between cell values.
fileName
(string; optional): String to use as the file name.
onlySelected
(boolean; optional): Export only selected rows.
onlySelectedAllPages
(boolean; optional): Only export selected rows including other pages (only makes sense when using pagination).
prependContent
(string; optional): Content to put at the top of the file export. A 2D array of CsvCell objects.
skipColumnGroupHeaders
(boolean; optional): Set to True to skip include header column groups.
skipColumnHeaders
(boolean; optional): Set to True if you don’t want to export column headers.
skipPinnedBottom
(boolean; optional): Set to True to suppress exporting rows pinned to the bottom of the grid.
skipPinnedTop
(boolean; optional): Set to True to suppress exporting rows pinned to the top of the grid.
skipRowGroups
(boolean; optional): Set to True to skip row group headers if grouping rows. Only relevant when grouping rows.
suppressQuotes
(boolean; optional): Pass True to insert the value into the CSV file without escaping. In this case it is your responsibility to ensure that no cells contain the columnSeparator character.