Insert table into Google Doc
insert_tableInsert an empty table with specified rows and columns at a chosen index in a Google Doc, enabling structured content directly in your document.
Instructions
Insert an empty table with the given number of rows and columns at an index of a Google Doc. Google inserts a paragraph break before the table, so the table starts at index + 1 (returned as tableStartIndex). The index must be inside an existing paragraph — not at a table’s start and not inside a footnote; to add a table at the end use bodyEndIndex-1 from get_document. Every cell starts with an empty paragraph: call get_document afterwards to get exact cell indexes, then fill cells with insert_text starting from the LAST cell so earlier indexes stay valid. Inserting shifts every later index.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| rows | Yes | Number of rows (1-100). | |
| index | Yes | A Google Docs index (UTF-16 offset). The body starts at index 1. Get exact indexes from get_document (structure) or find_text. | |
| columns | Yes | Number of columns (1-20). | |
| documentId | Yes | The Google Docs document ID (the part between /d/ and /edit in the document URL). A full Google Docs URL is also accepted. |