Sheet kit command

pivot.fields

Pivot Table Fields

Answers a pivot table's source fields (name, numeric, date, sample values) and its current layout; select a cell in the pivot table or name it.

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

Parameters

Parameters of pivot.fields
NameTypeRequiredDescription
pivotstring | integernodefault: the pivot table at the active cell

Call through sheet_run

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

The required parameters, with placeholders for their types: not a tested example. Optional: pivot. sheet_run answers the step’s result in completed[i].result.

Result

Result of pivot.fields
NameTypeRequiredDescription
anchorstringno
columnsany[]no
fieldsobject[]no
filtersany[]no
grandTotalsColsbooleanno
grandTotalsRowsbooleanno
idnumberno
layoutstringno
namestringno
rangestringno
recordsnumberno
rowsobject[]no
sheetstringno
showHeadersbooleanno
sourcestringno
stylestringno
subtotalsstringno
valuesobject[]no
Result JSON Schema
json
{
  "additionalProperties": true,
  "properties": {
    "anchor": {
      "type": "string"
    },
    "columns": {
      "type": "array"
    },
    "fields": {
      "items": {
        "additionalProperties": true,
        "properties": {
          "areas": {
            "items": {
              "type": "string"
            },
            "type": "array"
          },
          "date": {
            "type": "boolean"
          },
          "name": {
            "type": "string"
          },
          "numeric": {
            "type": "boolean"
          },
          "samples": {
            "items": {
              "type": "string"
            },
            "type": "array"
          }
        },
        "type": "object"
      },
      "type": "array"
    },
    "filters": {
      "type": "array"
    },
    "grandTotalsCols": {
      "type": "boolean"
    },
    "grandTotalsRows": {
      "type": "boolean"
    },
    "id": {
      "type": "number"
    },
    "layout": {
      "type": "string"
    },
    "name": {
      "type": "string"
    },
    "range": {
      "type": "string"
    },
    "records": {
      "type": "number"
    },
    "rows": {
      "items": {
        "additionalProperties": true,
        "properties": {
          "collapsed": {
            "type": "array"
          },
          "field": {
            "type": "string"
          },
          "group": {
            "type": "string"
          },
          "sort": {
            "type": "string"
          }
        },
        "type": "object"
      },
      "type": "array"
    },
    "sheet": {
      "type": "string"
    },
    "showHeaders": {
      "type": "boolean"
    },
    "source": {
      "type": "string"
    },
    "style": {
      "type": "string"
    },
    "subtotals": {
      "type": "string"
    },
    "values": {
      "items": {
        "additionalProperties": true,
        "properties": {
          "field": {
            "type": "string"
          },
          "func": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "numberFormat": {},
          "showAs": {
            "type": "string"
          }
        },
        "type": "object"
      },
      "type": "array"
    }
  },
  "type": "object"
}

Parameter schema

json
{
  "additionalProperties": false,
  "properties": {
    "pivot": {
      "description": "default: the pivot table at the active cell",
      "oneOf": [
        {
          "description": "a pivot table name",
          "type": "string"
        },
        {
          "description": "a pivot table id",
          "type": "integer"
        }
      ]
    }
  },
  "returns": "source fields (name, numeric, date, samples, areas) and the current layout",
  "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.