# exportPivot (@salmonui/export/pivot)

> The exportPivot function of @salmonui/export/pivot: Exports a pivot result (or a window source, paged) as XLSX (default; several results become one sheet each, or xlsx.layout: 'stacked'), PDF or CSV. XLSX: an outlined sheet with stacked merged column headers, row outline levels, number formats from model.formats, subtotal and grand total styles, conditional formats and the cell hook. PDF: the same table with the column headers repeated on every page, then one page per chart image. CSV: one header line of column paths (2024 / Sum of Amount, the labels of every column header level joined), then raw numbers, or the formatted texts with csv.values: 'formatted'. Resolves to { fileName, mimeType, data }, or null when onBeforeExport prevents it.

Canonical: https://salmonui.dev/docs/reference/export/pivot/exportPivot

```ts
import { exportPivot } from '@salmonui/export/pivot';
```

Entry index: https://salmonui.dev/docs/reference/export/pivot (Markdown with every symbol of the entry: https://salmonui.dev/docs/reference/export/pivot.md).

## Reference

Kind: function

```ts
function exportPivot(source: PivotExportSource, options: PivotFileExportOptions & {
    readonly format: 'csv';
}, handlers?: PivotExportHandlers<string>): Promise<ExportFile<string> | null>;

function exportPivot(source: PivotExportSource | readonly PivotExportSource[], options?: PivotFileExportOptions & {
    readonly format?: 'xlsx' | 'pdf';
}, handlers?: PivotExportHandlers): Promise<ExportFile | null>;

function exportPivot(source: PivotExportSource | readonly PivotExportSource[], options?: PivotFileExportOptions, handlers?: PivotExportHandlers<Uint8Array | string>): Promise<ExportFile<Uint8Array | string> | null>;
```

Exports a pivot result (or a window source, paged) as XLSX
(default; several results become one sheet each, or `xlsx.layout:
'stacked'`), PDF or CSV. XLSX: an outlined sheet with stacked merged column
headers, row outline levels, number formats from `model.formats`, subtotal
and grand total styles, conditional formats and the `cell` hook.
PDF: the same table with the column headers repeated on every page, then one page per `chart` image. CSV: one header line of column paths (`2024 / Sum of Amount`,
the labels of every column header level joined), then raw numbers, or the
formatted texts with `csv.values: 'formatted'`. Resolves to
`{ fileName, mimeType, data }`, or null when `onBeforeExport` prevents it.
