Sheet kit command

table.formatAs

Format as Table

Formats a range (default: the selection, or the data around the active cell) with a table style: as a table (mode table, the default), or only its look written into the cells (mode format, Only Format As Table, with titleRows header rows).

Kit
Sheet 0.1.0 (.xlsx (and opens .xlsm, .xls, .xltx, .csv, .ods, .xlsb))
Changes the document
yes

Parameters

Parameters of table.formatAs
NameTypeRequiredDescription
clearPicturesbooleannopictures in the header row go; without it they refuse the table
columnPrefixstringnothe generic name for empty headers, numbered (Column1, 列1)
filterbooleannowith mode table: whether the header shows filter buttons (default true)
headerbooleanno
mode"table" | "format"notable (a table with a header row, filter buttons and bands) or format (only the look, written into the cells)
rangestringnocells in A1 notation such as B2 or B2:D10, optionally with a sheet (Sheet2!A1); default: the selection
stylestringnoa table style name: TableStyleLight1…21, TableStyleMedium1…28, TableStyleDark1…11, or one the workbook defines; default: the workbook's default table style
titleRowsintegernowith mode format: how many rows on top take the header's format (0 for none)

Call through sheet_run

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

The required parameters, with placeholders for their types: not a tested example. Optional: clearPictures, columnPrefix, filter, header, mode, range, style, titleRows. sheet_run answers the step’s result in completed[i].result.

Result

The kit gives no result schema for this command.

Parameter schema

json
{
  "additionalProperties": false,
  "properties": {
    "clearPictures": {
      "description": "pictures in the header row go; without it they refuse the table",
      "type": "boolean"
    },
    "columnPrefix": {
      "description": "the generic name for empty headers, numbered (Column1, 列1)",
      "type": "string"
    },
    "filter": {
      "description": "with mode table: whether the header shows filter buttons (default true)",
      "type": "boolean"
    },
    "header": {
      "type": "boolean"
    },
    "mode": {
      "description": "table (a table with a header row, filter buttons and bands) or format (only the look, written into the cells)",
      "enum": [
        "table",
        "format"
      ],
      "type": "string"
    },
    "range": {
      "description": "cells in A1 notation such as B2 or B2:D10, optionally with a sheet (Sheet2!A1); default: the selection",
      "type": "string"
    },
    "style": {
      "description": "a table style name: TableStyleLight1…21, TableStyleMedium1…28, TableStyleDark1…11, or one the workbook defines; default: the workbook's default table style",
      "type": "string"
    },
    "titleRows": {
      "description": "with mode format: how many rows on top take the header's format (0 for none)",
      "type": "integer"
    }
  },
  "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.