Sheet kit command

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))
Changes the document
no

Parameters

Parameters of file.export
NameTypeRequiredDescription
bombooleannocsv: UTF-8 with a byte-order mark, CSV UTF-8
fitToPagebooleannopdf
format"pdf" | "csv" | "html" | "xlsx" | "xltx" | "png"no
rangestringnolike A1:F40; pdf, png: active sheet
sheetanynocsv, html, png: index or name; the active sheet by default
sheets"active" | "all"nopdf

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

Result of file.export
NameTypeRequiredDescription
bytesnumberno
datastringnoThe file's bytes, base64
extensionstringno
format"pdf" | "csv" | "html"no
mimestringno
pagesnumbernoPDF only: pages
Result JSON Schema
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/[email protected] and the kit itself (sheet_commands through @kition/[email protected], built from KitionAI/kition-sheet@82f13b2). As data: commands.jsonl.