Add a pivot table
add_pivot_tableSummarize a Google Sheets table with a pivot table: group rows or columns, total, count, or average values, and output to a new tab or chosen anchor cell.
Instructions
Summarize a table with a pivot table: group by one or more columns, and total, count or average others. It goes on a new tab unless anchor_cell is given. The source range needs a header row; refer to columns by header name or letter.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| rows | No | Columns to group by down the side, e.g. ["Region"] | |
| values | Yes | ||
| account | No | Google account to use: an email or unique part of one (e.g. "acme.com"). Default: the account that can open the spreadsheet, else the default account. | |
| columns | No | Columns to group by across the top | |
| anchor_cell | No | Top-left cell for the pivot table, e.g. "Summary!A1". The area below and right of it must be empty. Default: a new tab | |
| show_totals | No | ||
| spreadsheet | Yes | Google Sheets link or spreadsheet ID. The name of a spreadsheet used with Sheets MCP before also works | |
| new_tab_name | No | Name for the new tab when anchor_cell isn't given | Pivot |
| source_range | Yes | The table to summarize, header row included, e.g. "Orders!A1:F500" or a tab name |