# Programmatic CSV Export

The KendoReact Grid provides programmatic methods via the Grid ref to export CSV data without using the built-in `GridCsvExportButton` component. This enables custom export workflows such as uploading to a server or previewing the data before download.

<CtaPanelOverview></CtaPanelOverview>

## Grid Ref Methods

The Grid exposes two CSV-related methods through its ref:

| Method         | Returns         | Description                                                                            |
| -------------- | --------------- | -------------------------------------------------------------------------------------- |
| `saveAsCsv()`  | `Promise<void>` | Triggers a CSV file download. Returns a Promise that resolves when export is triggered |
| `getCsvBlob()` | `Blob \| null`  | Returns the CSV data as a Blob for custom handling                                     |

## Usage Example

The following example demonstrates both methods:

* **Download CSV** - Uses `saveAsCsv()` to trigger an immediate file download with async/await
* **Upload to Server** - Uses `getCsvBlob()` to get the Blob for custom upload logic
* **Preview CSV** - Uses `getCsvBlob()` to read and display the CSV content

[Demo Source](https://demos.telerik.com/kendo-react-ui/grid/csv-export/programmatic-export/source.txt)

## Suggested Links

* [CSV Export Basics](https://www.telerik.com/kendo-react-ui-develop/components/grid/export/csv-export)
* [Exporting Grouped Data](https://www.telerik.com/kendo-react-ui-develop/components/grid/export/csv-export/grouped-data)
* [Data Transformation](https://www.telerik.com/kendo-react-ui-develop/components/grid/export/csv-export/data-transformation)
* [API Reference of the Grid](https://www.telerik.com/kendo-react-ui-develop/components/grid/api/gridprops)
