The grid provides in-built Excel (xlsx) export functionality without the need for any third party libraries. Exporting to Excel can be performed from the Context Menu or programmatically via the Grid API and the exported spreadsheets can be fully customised and styled to meet user requirements.
Excel export is also possible via the Grid API using the following method:
No special configurations or third party libraries are required for either approach.
The default Excel export behaviour will export the grid as it is currently rendered. This means the exported spreadsheet will match what is displayed in the grid at the time of export following any sorting, filtering, row grouping, columns visible, grouped columns etc...
Note that the raw values, and not the result from a cell renderer will be used, meaning the results from:
In the following example reorder some columns and apply some filter and sort operations - then export from the 'Excel Export' option in the context menu, or the 'Export to Excel' button provided. Note the following:
The column width in Excel will be the same as the actual width of the column in the application at the time that the export happens, or 75px, whichever is wider. "Actual width" may be different from the width in the column definition if column has been resized or uses flex sizing. This can be overridden using the
columnWidth export parameter.
The data types of your columns are passed to Excel as part of the export so that you can work with the data within Excel in the correct format.
The cells of the column header groups are merged in the same manner as the group headers in AG Grid.
The Default Excel Export behaviour will meet the requirements of most applications. However, you can apply extensive customisation to the values exported, layout, value formatting and styling of the exported spreadsheets.
The sections below cover the various ways the exported Excel spreadsheets can be customised:
Continue to the next section: API Reference.