CSV Export

Download table data with exportToCSV.

Export to CSV

Get the table API and call exportToCSV. Optional filename defaults to table-export.csv. Exports all rows (every page when paginated), respecting active filters and sort.

React TSX
const tableRef = useRef(null);
<button onClick={() => tableRef.current?.exportToCSV({ filename: "report.csv" })}>
Export CSV
</button>
<SimpleTable ref={tableRef} columns={columns} rows={rows} />

Omit header row

Set includeHeadersInCSVExport to false to export data rows only.

React TSX
<SimpleTable
columns={columns}
rows={rows}
includeHeadersInCSVExport={false}
/>

Control which columns export

excludeFromCsv keeps a column in the UI but out of the file. excludeFromRender hides it in the table (and column editor) but still includes it in the CSV.

TypeScript
{
accessor: "actions",
label: "Actions",
excludeFromCsv: true,
}
{
accessor: "internalId",
label: "Internal ID",
excludeFromRender: true,
}

Columns with a valueFormatter export the formatted text by default. Override with useFormattedValueForCSV or exportValueGetter— see Value Formatter.

Example

Use the export button in the demo. Code or StackBlitz has the full example.

Props

CSV Export Configuration

PropertyRequiredDescriptionExample
includeHeadersInCSVExport
boolean
Optional
Include column labels as the first CSV row. Defaults to true.
ColumnDef.excludeFromCsv
boolean
Optional
Show the column in the table but omit it from CSV export.
ColumnDef.excludeFromRender
boolean
Optional
Hide the column in the table/editor while still exporting it to CSV.

exportToCSV options

ExportToCSVProps

PropertyRequiredDescriptionExample
filename
string
Optional
Custom filename for the exported CSV file. Defaults to 'table-export.csv' if not provided.