Insert a table
insert_tableInsert a table with your chosen number of rows and columns into a Google Doc. Use a 2D array to fill cell text, set alignment and header shading, and choose the position.
Instructions
Insert a rows×columns table, optionally populated from a 2D array of cell text — cell text may use inline markdown (bold, italic, code, links). Per-column alignment via align. Position via at (top/end/or a unique text anchor, default end). A direct edit, not a tracked suggestion.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| at | No | "top", "end", or a unique text snippet to insert after (default end) | |
| tab | No | Target a specific tab by tabId or title (from list_tabs). Defaults to the first tab. | |
| data | No | row-major cell text, e.g. [["A","B"],["1","2"]] | |
| page | No | which header/footer, when a doc defines more than one (default-page, first-page, even-page). Omit to use whichever exists. | |
| rows | Yes | ||
| align | No | per-column text alignment, e.g. ["left","right"]; null or "left" leaves a column at the default | |
| account | No | Google account email to use. Defaults to GDOCS_DEFAULT_ACCOUNT, or the sole account. | |
| columns | Yes | ||
| segment | No | which content tree to target: body (default), or the page header/footer. Header/footer content is invisible to a body read — a letterhead logo lives there. | |
| documentId | Yes | ||
| headerShade | No | hex background color for the first row, e.g. #f1f3f4 | |
| columnWidths | No | fixed width per column, in points | |
| createSegment | No | when segment is header/footer and the doc has none, create it first. Only the default header/footer can be created via the API. |