Customising Cell and Row Group values Copy Link
By default, the values exported to Excel will be formatted via the Using the Value Formatter for Export feature.
The grid cell and row group values can be customised specifically for Excel export using the following function params for a call to exportDataAsExcel API method or in the defaultExcelExportParams.
gridApi.exportDataAsExcel({
processCellCallback(params) {
const value = params.value
return value === undefined ? '' : `_${value}_`
},
processRowGroupCallback(params) {
return `row group: ${params.node.key}`
}
})See below the functions on the ExcelExportParams interface to customise exported grid cell and row group values.
A callback function invoked once per cell in the grid. Return a string value to be displayed in the export. For example this is useful for formatting date values.
|
A callback function invoked once per row group. Return a string to be displayed in the group cell.
|
The following example shows Excel customisations where the exported document has the following:
- All row groups with the prefix
row group: - All cell values surrounded by
_, unless they areundefined, in which case they are empty
When using row grouping while hiding open parents (groupHideOpenParents=true), export to Excel doesn't export the group rows as collapsible groups in Excel. Instead, all exported rows are on the same level and cannot be expanded/collapsed in Excel.
Customising Column Headers and Group Header Values Copy Link
The column headers and group headers exported to Excel can be customised using the following function params for a call to exportDataAsExcel API method or in the defaultExcelExportParams.
gridApi.exportDataAsExcel({
processGroupHeaderCallback(params) {
return `group header: ${params.api.getDisplayNameForColumnGroup(params.columnGroup, null)}`
},
processHeaderCallback(params) {
return `header: ${params.api.getDisplayNameForColumn(params.column, null)}`
}
});See below the functions on the ExcelExportParams interface to customise exported column group headers and headers.
A callback function invoked once per column. Return a string to be displayed in the column header.
|
A callback function invoked once per column group. Return a string to be displayed in the column group header. Note that column groups are exported by default, this option will not work with skipColumnGroupHeaders=true.
|
The following example shows Excel customisations where the exported document has the following:
- Group headers with the prefix
group header: - Headers with the prefix
header:
Custom Metadata Copy Link
Use customMetadata to write custom document properties to the exported file. The values are added as metadata to the Excel file and serialised as strings.
This is useful for attaching internal identifiers, workflow hints, or metadata consumed by downstream systems.
Use cases for custom metadata may include:
- Internal workflow tagging (for example, adding
ExportIDorGeneratedByfor tracking in automation scripts). - Integration with document management systems (for example, embedding
ContractTypeorExpirationDatefor indexing in SharePoint or similar tools). - Integration with third-party analytics tools (for example, passing
CampaignIDfor BI dashboard automation).
gridApi.exportDataAsExcel({
customMetadata: {
ExportID: 'EXP-2026-001',
ExpirationDate: '2025-01-01T12:00:00Z',
Disclaimer: 'Preliminary data; subject to audit',
},
});Properties available on the ExcelExportParams interface.
Custom metadata to write to docProps/custom.xml in the exported file. Values are serialised as strings.
|
The Grid does not interpret these values or apply labels; it only writes the custom properties provided in the customMetadata parameter. This feature does not replace or integrate with officially endorsed labelling systems, such as Microsoft Purview Sensitivity Labels, which require specific SDKs or APIs for enforcement, encryption, and compliance.
Next Up Copy Link
Continue to the next section: Images.