Beyond the Prompt A one-day AG Grid & Bryntum conference • 19th May 26 Learn more




Core Features

Advanced Features

JavaScript Data GridExcel Export - Notes

Enterprise

Excel notes/comments can be added to exported cells using a callback, exported automatically from the Notes feature, or attached to custom content rows.

Adding Notes to Cells Copy Link

Use processNoteCallback to inject notes during export. The callback is invoked for each exported cell and receives the cell value, column, and row node. Return an ExcelNote object to attach a note, undefined to keep the default behaviour, or null to suppress the note for the current cell.

If a note does not specify an author, the Excel document author is used. When the document author is not provided, the exporter falls back to AG Grid.

const gridOptions = {
    defaultExcelExportParams: {
        processNoteCallback: (params) => {
            if (params.column.getColId() === 'gold' && Number(params.value) >= 5) {
                return {
                    text: `Outstanding medal count (${params.value} gold).`,
                };
            }
        },
     },

    // other grid options ...
}

Exporting Grid Notes Copy Link

When the Notes feature is enabled and notesDataSource is configured, cell notes are exported automatically as Excel notes/comments. No callback is needed.

Suppressing Grid Notes Copy Link

Set suppressGridNotesExport to true to prevent grid notes from being included in the export. The grid still displays notes, but the exported file will not contain them. Callback-based note injection via processNoteCallback still works when this is set.

const gridOptions = {
    defaultExcelExportParams: {
        suppressGridNotesExport: true,
     },

    // other grid options ...
}

Customising Exported Notes Copy Link

The processNoteCallback can be used to customise existing grid notes before they are exported. For cells that contain grid notes the processNoteCallback provides both excelNote and gridNote.

  • excelNote - is the note that will be exported to Excel
  • gridNote - is the source grid note for this cell

The example below shows how the existing excelNote text can be updated to include the updatedAt value from the underlying gridNote.

const gridOptions = {
    notesDataSource,
    defaultExcelExportParams: {
        processNoteCallback: (params) => {
            if (params.excelNote) {
                return {
                    ...params.excelNote,
                    text: `${params.excelNote.text}\n\nUpdated: ${params.gridNote?.updatedAt ?? 'Not recorded'}`,
                };
            }
        },
    },

    // other grid options ...
}

Hiding Author Copy Link

By default, the author name is prepended as bold text in the Excel note body (matching Excel's native behaviour). Set suppressPrependAuthorToNotes to true to export only the note text. The author is still stored in the Excel workbook's note metadata.

const gridOptions = {
    defaultExcelExportParams: {
        author: 'Portfolio Ops',
        suppressPrependAuthorToNotes: true,
     },

    // other grid options ...
}

Adding Notes to Extra Content Copy Link

Cells in extra content rows can carry Excel notes via ExcelCell.note.

const gridOptions = {
    defaultExcelExportParams: {
        prependContent: [
            {
                cells: [
                    {
                        data: { type: 'String', value: 'Export Summary' },
                        note: {
                            text: 'This note is added only during export through ExcelCell.note.',
                        },
                    },
                ],
            },
        ],
    },

    // other grid options ...
}

API Copy Link

ExcelNote Copy Link

Properties available on the ExcelNote interface.

See Notes for more information.

text requiredCopy Link
string
The body text to export in the Excel note/comment.
authorCopy Link
string
Optional author name displayed in the exported Excel note. When omitted, the document author is used.

ProcessNoteForExportParams Copy Link

Properties available on the ProcessNoteForExportParams<TData = any, TContext = any> interface.

See Notes for more information.

gridNoteCopy Link
Note
The grid note resolved for the current cell, when the Notes feature is available.
excelNoteCopy Link
ExcelNote
The Excel note/comment value derived from gridNote when automatic note export is enabled.
any
The raw cell value before any formatting or processing.
accumulatedRowIndexCopy Link
number
The zero-based row index in the exported output, including any prepended content rows. Only populated for file export flows ('excel', 'csv'); omitted for clipboard flows.
The row node for the cell. May be null or undefined for clipboard flows when no row is associated.
The column for the cell.
string
The operation that triggered the callback
parseValueCopy Link
Function
Utility function to parse a value using the column's colDef.valueParser
formatValueCopy Link
Function
Utility function to format a value using the column's colDef.valueFormatter
The grid api.
Application context as set on gridOptions.context.