---
title: "file.export: Export — Sheet kit command — Kition"
description: "Answers the workbook as a PDF laid out as Print lays it out (the active sheet or all sheets, a range, fit to page), or one sheet as CSV or a web page (HTML), as base64 for the host to write as a new file; nothing is written and the workbook does not change."
canonical: "https://developer.kition.ai/docs/kits/sheet/commands/file.export"
---

> Canonical HTML: [https://developer.kition.ai/docs/kits/sheet/commands/file.export](https://developer.kition.ai/docs/kits/sheet/commands/file.export)

# file.export

**Export.** Answers the workbook as a PDF laid out as Print lays it out (the active sheet or all sheets, a range, fit to page), or one sheet as CSV or a web page (HTML), as base64 for the host to write as a new file; nothing is written and the workbook does not change.

- Kit: Sheet 0.1.0 (.xlsx (and opens .xlsm, .xls, .xltx, .csv, .ods, .xlsb)); reference: [Sheet kit commands](https://developer.kition.ai/docs/kits/sheet.md)
- Changes the document: no

## Parameters

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `bom` | `boolean` | no | csv: UTF-8 with a byte-order mark, CSV UTF-8 |
| `fitToPage` | `boolean` | no | pdf |
| `format` | `"pdf" \| "csv" \| "html" \| "xlsx" \| "xltx" \| "png"` | no |  |
| `range` | `string` | no | like A1:F40; pdf, png: active sheet |
| `sheet` | `any` | no | csv, html, png: index or name; the active sheet by default |
| `sheets` | `"active" \| "all"` | no | pdf |

## Call through sheet_run

```text
sheet_run {
  "path": "<file>.xlsx",
  "steps": [{ "command": "file.export" }]
}
```

The required parameters, with placeholders for their types: not a tested example. Optional: `bom`, `fitToPage`, `format`, `range`, `sheet`, `sheets`. sheet_run answers the step’s result in `completed[i].result`.

## Result

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `bytes` | `number` | no |  |
| `data` | `string` | no | The file's bytes, base64 |
| `extension` | `string` | no |  |
| `format` | `"pdf" \| "csv" \| "html"` | no |  |
| `mime` | `string` | no |  |
| `pages` | `number` | no | PDF only: pages |

```json
{
  "additionalProperties": false,
  "properties": {
    "bytes": {
      "type": "number"
    },
    "data": {
      "description": "The file's bytes, base64",
      "type": "string"
    },
    "extension": {
      "type": "string"
    },
    "format": {
      "enum": [
        "pdf",
        "csv",
        "html"
      ],
      "type": "string"
    },
    "mime": {
      "type": "string"
    },
    "pages": {
      "description": "PDF only: pages",
      "type": "number"
    }
  },
  "type": "object"
}
```

## Parameter schema

```json
{
  "additionalProperties": false,
  "properties": {
    "bom": {
      "description": "csv: UTF-8 with a byte-order mark, CSV UTF-8",
      "type": "boolean"
    },
    "fitToPage": {
      "description": "pdf",
      "type": "boolean"
    },
    "format": {
      "enum": [
        "pdf",
        "csv",
        "html",
        "xlsx",
        "xltx",
        "png"
      ],
      "type": "string"
    },
    "range": {
      "description": "like A1:F40; pdf, png: active sheet",
      "type": "string"
    },
    "sheet": {
      "description": "csv, html, png: index or name; the active sheet by default",
      "x-khp-name": "name",
      "x-khp-types": [
        "Sheet"
      ]
    },
    "sheets": {
      "description": "pdf",
      "enum": [
        "active",
        "all"
      ],
      "type": "string"
    }
  },
  "returns": "{format, extension, mime, bytes, data (base64), pages? (pdf)}; xlsx is a copy of the workbook, xltx the workbook as a template, png a picture of the sheet's cells (the kit's renderer)",
  "type": "object"
}
```

Generated from the command list of @kition/sheet-darwin-arm64@0.1.0 and the kit itself (sheet_commands through @kition/cli@0.1.1, built from KitionAI/kition-sheet@82f13b2).
