As for now, the suppressExcelExport: true
property works only for the entire grid, not the columns!
However there is a nice workaround which will enable any custom column property (e.g. suppressExcelExport
) to act like a real working property as you asked.
All you need is calling this function on a button click or add context menu item:
function exportActiveColumns() {
let allColumns = gridOptions.columnApi.getAllColumns();
let exportColumns = allColumns .filter(col => !col.userProvidedColDef.suppressExcelExport);
gridOptions.api.exportDataAsExcel({
columnKeys: exportColumns,
});
}
Make sure suppressExcelExport
is false
for the grid, otherwise there will be no result after calling exportDataAsExcel
api.
Exact same thing works for CSV.