Sheet kit command
edit.moveCells
Move Cells
Moves (or copies) a block of cells to a new top-left cell, as dragging the selection's border does: values, formulas, formats, merged areas, notes, links, conditional formats, validation and tables go with the cells, and formulas that refer to them follow. With insert the cells at the destination make room (down or right) and the place left behind closes up; whole rows and columns move as rows and columns. Answers the range where the block landed (it is selected).
- Kit
- Sheet 0.1.0 (.xlsx (and opens .xlsm, .xls, .xltx, .csv, .ods, .xlsb))
- Changes the document
- yes
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
copy | boolean | no | leave the block where it is and paste a copy (a drag with Cmd/Ctrl held) |
from | string | no | the block in A1 notation such as B2:C4, whole rows such as 3:4 or columns such as C:D; default: the selection |
insert | "down" | "right" | no | make room at `to` instead of overwriting (a drag with Shift held): down moves the cells there down, right moves them right |
right | number | no | the cells at `to` make room, as a drag with Shift held: down moves them down, right moves them right; whole rows and columns always make room as rows or columns; one of several alternative parameters |
to | string | no | the block's new top-left cell such as E5 (a row's or a column's first cell for whole lines) |
Call through sheet_run
sheet_run {
"path": "<file>.xlsx",
"steps": [{ "command": "edit.moveCells" }]
}The required parameters, with placeholders for their types: not a tested example. Optional: copy, from, insert, right, to. sheet_run answers the step’s result in completed[i].result.
Result
| Name | Type | Required | Description |
|---|---|---|---|
range | string | no |
Result JSON Schema
{
"additionalProperties": false,
"properties": {
"range": {
"type": "string"
}
},
"type": "object"
}Parameter schema
{
"additionalProperties": false,
"properties": {
"copy": {
"description": "leave the block where it is and paste a copy (a drag with Cmd/Ctrl held)",
"type": "boolean"
},
"from": {
"description": "the block in A1 notation such as B2:C4, whole rows such as 3:4 or columns such as C:D; default: the selection",
"type": "string"
},
"insert": {
"description": "make room at `to` instead of overwriting (a drag with Shift held): down moves the cells there down, right moves them right",
"enum": [
"down",
"right"
],
"type": "string"
},
"right": {
"description": "the cells at `to` make room, as a drag with Shift held: down moves them down, right moves them right; whole rows and columns always make room as rows or columns; one of several alternative parameters",
"type": "number"
},
"to": {
"description": "the block's new top-left cell such as E5 (a row's or a column's first cell for whole lines)",
"type": "string"
}
},
"returns": "{range}: a drag of the selection's border: the cells move with their values, formulas, formats, merged areas, notes, links, conditional formats, validation and tables, and formulas anywhere that refer to them follow",
"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.