GRID FEATURE

CSV export

CSV export creates a text file for exchanging table data with other tools. It does not preserve cell colors, column widths, detail panels, or other visual layout.

How it works and when to use it

Use exportDataAsCsv to download, or getDataAsCsv to process text in the app. The latter returns an object containing csv and row/column counts, not a plain string.

In the code, grid is the Grid element prepared in the installation chapter. Check each example's data and settings, and implement the app functions and server endpoints for your project.

Example 1. Download a file

Call from a user button interaction in the browser.

javascript
const result = await grid.exportDataAsCsv({ fileName: 'orders.csv' });
console.log(result.rowCount, result.columnCount);

Verify the result: The CSV download starts, and you can inspect the actual output row and column counts.

Example 2. Preview text

Use an app preview or approval step instead of downloading.

javascript
const result = await grid.getDataAsCsv();
console.log(result.csv);

Verify the result: Read the generated CSV text. Converting the entire result object to a string does not produce a CSV file.

Example 3. Review export scope

For reports combining filters, hidden columns, and selected rows, specify the desired scope in CsvExportOptions. Compare row counts and content against a small known dataset.

Verify the result: Do not assume unloaded server rows are included automatically. Implement a separate server export using the same query conditions for complete server data.

Combining features and troubleshooting

Check output-protection behavior when user input begins with spreadsheet formula characters such as =. CSV does not preserve the screen renderer's appearance.

Check download permissions, sensitive-column access policy, and the actual file contents together.

Related reading