---
id: "packages/active-grid/api/export-utils"
title: "Export utils"
description: "copyToClipboard, exportToCSV, exportToCSVGrouped, exportToCSVServerGrouped and 13 more: generated from the source of active-grid."
url: "/packages/active-grid/api/export-utils"
locale: "en"
revision: "g0mvjxwj5c-88bdbe1c:export-utils"
---

# Export utils

Exported by `@workspace/active-grid`. Generated from the package source; part of [the index of every export](/packages/active-grid/api).

## Functions, hooks and constants

**copyToClipboard**: `<TData>(publicRows: readonly Row<TData>[], publicGrid: Grid<TData>, options: GridClipboardOptions) => Promise<boolean>`

Copy rows to the clipboard as TSV.

The clipboard copy is deliberately PRESENTATION output: whoever copies,
copies what they see -- formatted dates, amounts with their symbol,
translated badge labels. This is NOT a machine export contract; whoever
needs data uses the CSV/XLSX/JSON export in the default DATA mode.

**exportToCSV**: `<TData>(publicRows: readonly Row<TData>[], publicGrid: Grid<TData>, filename: string, options?: GridExportRunOptions, csvDelimiter?: CsvDelimiter) => void`

**exportToCSVGrouped**: `<TData>(publicGrid: Grid<TData>, filename: string, scope: "all" \| "filtered", options?: GridExportRunOptions, csvDelimiter?: CsvDelimiter) => void`

Export to CSV with group structure. Group headers and footers are
rendered as distinct rows.

**exportToCSVServerGrouped**: `<TData>(publicGrid: Grid<TData>, config: ServerGroupedExportConfig<TData>, filename: string, options?: GridExportRunOptions, csvDelimiter?: CsvDelimiter) => Promise<void>`

Export server-side grouped data to CSV. Traverses the group tree by calling
fetchFn for each group level.

**exportToExcel**: `<TData>(publicRows: readonly Row<TData>[], publicGrid: Grid<TData>, filename: string, options?: GridExcelExportOptions) => Promise<void>`

**exportToExcelGrouped**: `<TData>(publicGrid: Grid<TData>, filename: string, scope: "all" \| "filtered", options?: GridExcelExportOptions) => Promise<void>`

Export to Excel with group structure. Group headers occupy the first cell
of their row, footers show aggregated values.

**exportToExcelServerGrouped**: `<TData>(publicGrid: Grid<TData>, config: ServerGroupedExportConfig<TData>, filename: string, options?: GridExcelExportOptions) => Promise<void>`

Export server-side grouped data to Excel.

**exportToJSON**: `<TData>(publicRows: readonly Row<TData>[], publicGrid: Grid<TData>, filename: string, options?: GridExportRunOptions) => void`

**exportToJSONGrouped**: `<TData>(publicGrid: Grid<TData>, filename: string, scope: "all" \| "filtered", options?: GridExportRunOptions) => void`

Export to JSON with hierarchical group structure.

**exportToJSONServerGrouped**: `<TData>(publicGrid: Grid<TData>, config: ServerGroupedExportConfig<TData>, filename: string, options?: GridExportRunOptions) => Promise<void>`

Export server-side grouped data to JSON with hierarchical structure.

**exportToPDF**: `<TData>(publicRows: readonly Row<TData>[], publicGrid: Grid<TData>, filename: string, options: GridPdfExportOptions) => Promise<void>`

Export rows to PDF as a formatted table. Uses jsPDF + jspdf-autotable,
optional dependencies loaded on first use.

PDF is presentation output by definition: it renders the
same human-readable form as the grid, so it takes the viewer's locale.
Rejects with a `GridExportError` for text it cannot draw; no file is
produced then.

**exportToPDFGrouped**: `<TData>(publicGrid: Grid<TData>, filename: string, scope: "all" \| "filtered", options: GridPdfExportOptions) => Promise<void>`

Export to PDF with group structure. Group headers are rendered as spanning
rows, group footers show aggregated values in bold.

**exportToPDFServerGrouped**: `<TData>(publicGrid: Grid<TData>, config: ServerGroupedExportConfig<TData>, filename: string, options: GridPdfExportOptions) => Promise<void>`

Export server-side grouped data to PDF.

## Types

**GridClipboardOptions**

```ts
interface GridClipboardOptions {
  locale: GridPresentation;
  includeHeaders?: boolean;
  diagnostics?: GridDiagnosticSink;
}
```

Options for the clipboard copy. Presentation output, so with a locale.

**GridExcelExportOptions**

```ts
type GridExcelExportOptions = GridExportRunOptions & {
  direction?: GridExportDirection;
};
```

The options of an XLSX export: the data-mode options every data format
shares, plus the sheet's direction. There is deliberately no font: SheetJS
Community Edition writes no styles, and a workbook's look belongs to the
spreadsheet application.

**GridPdfExportOptions**

```ts
interface GridPdfExportOptions {
  locale: GridPresentation;
  fonts?: GridExportFonts | 'inherit';
  direction?: GridExportDirection;
}
```

PDF is HUMAN output: always presentation, so always with a locale. The
other two fields are the explicit call's; the row menu fills them from the
grid.

**ServerGroupedExportConfig**

```ts
interface ServerGroupedExportConfig<TData> {
  fetchFn: ServerFetchFunction<TData>;
  groupBy: GroupByColumn[];
  groupAggregations?: GroupAggregation[];
  sorting?: SortingState;
  filters?: ColumnFiltersState;
  globalFilter?: string;
  onProgress?: (loaded: number, total: number) => void;
}
```

Configuration for server-side grouped export.
