insert_doc_table
Inserts an empty table at a chosen Google Docs position and returns cell indices for filling cells or applying formatting; also supports form-style column alignment.
Instructions
Insert an empty table at a specific position in a Google Doc.
The table is inserted at the given index. The document is re-fetched immediately to return the actual cell indices. Use those indices with insert_doc_text (targeting each cell's paragraphStartIndex) to fill cells, or with style_doc_table_cells to apply formatting.
Also useful for form-style column alignment (labels/values lined up without a visible table) — a zero-padding table gives exact column positions where tabStops would otherwise be needed (tabStops itself is read-only, #404). See docs/design/borderless-table-columns.md for the full recipe.
Args: doc_id: The Google Doc file ID. index: Document body index where the table should be inserted. Use get_doc_structure to find a suitable position (e.g. the endIndex of the paragraph before the intended location). rows: Number of table rows. columns: Number of table columns.
Returns: precedingParagraphIndex (= index), tableStartIndex (= index + 1), tableEndIndex, rows, columns, and a cells list (each cell has row, col, startIndex, endIndex, paragraphStartIndex). To fully delete the table later, delete the range [precedingParagraphIndex, tableEndIndex] in one call.
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"doc_id": "<doc_id>",
"index": "<index>",
"rows": "<rows>",
"columns": "<columns>"
},
"name": "insert_doc_table"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| rows | Yes | ||
| index | Yes | ||
| doc_id | Yes | ||
| columns | Yes |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||