Insert a table
insert_tableAdd an empty table to a Google Doc at a chosen position, or append it to the end when no position is given. Specify the number of rows and columns, then fill the cells with text.
Instructions
Inserts an empty rows x columns table at an index, or at the end of the body when index is omitted. Fill the cells afterwards: read_document_text shows the new table's range and per-cell layout, then insert_text into each cell (cell content ranges are visible in get_document; each cell holds its own paragraphs). Cell merging, cell background/borders and pinned header rows are not covered by typed tools — use raw_request with mergeTableCells/updateTableCellStyle/pinTableHeaderRows.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| rows | Yes | Number of rows. | |
| index | No | Insertion index (from read_document_text). Omit to append at the end. | |
| tab_id | No | Tab to target (from list_tabs). Omit for the first/only tab. | |
| columns | Yes | Number of columns (the API caps width). | |
| segment_id | No | Header/footer/footnote segment id (from get_document). Omit for the document body. | |
| document_id | Yes | The document id — the long id from the document URL (docs.google.com/document/d/<documentId>/edit) or from create_document output. |