Skip to main content
Glama

Add rows and tabs to a Google spreadsheet

google_sheets_add

Adds rows, columns, duplicated tabs, tables, charts, pivot tables, rules, validation, filters, and metadata to a Google spreadsheet in one atomic batch so all changes apply or none do.

Instructions

Add rows, columns, tabs, tables, conditional rules, data validation, filters, charts, pivot tables and developer metadata to a Google spreadsheet, by spreadsheet (its id or URL): 1 to 100 operations that apply in order as one batch, so all of them land or none does. It never removes or overwrites a cell or an object a person made, but it is not idempotent: applying the same operations again adds again. Each operation is an object with op and its arguments. insert takes a range of whole rows (Plan!5:7) or whole columns (Plan!C:D) and inserts as many empty ones as it spans before them, so the rows or columns named and everything after them shift down or right, and a later operation's range means the cells as they stand by then; inherit (before by default, or after) says whose formatting the new ones take, and the first row or column has none before it. tab_duplicate copies the tab as a new tab, with an optional title (no tab may have it already, ignoring case) and position counted from 0 (left out, right after the original); the result's created lists each new tab's sheet_id, title and index. table makes a native table of range, a closed block with its header row, that overlaps no table; name (default Table1, Table2…), table_columns ({ column, type?, name?, values? }: Google's column type, such as DOUBLE or DROPDOWN with its options in values), header_color, band_colors (one or two) and footer_color are optional, and a column new to the table that is not named keeps its header cell's text as its name; the result's tables lists each new table's table_id, name and range. conditional adds a conditional formatting rule over range or ranges of one tab, as the tab's first rule (the numbers of the others go up by one): either when (Google's condition type, such as NUMBER_GREATER) with its values and at least one style of bold, italic, strikethrough, color and background, or scale, two or three colors from the lowest value up. validate sets a data validation rule over range or ranges that have none: when (such as ONE_OF_LIST, whose options are values, or NUMBER_BETWEEN), values, strict (default true: reject other input, false: warn), dropdown (default true) and help; a range that has validation already is refused (google_sheets_restructure's validate_replace replaces it), and so is a range of more than 10,000 cells, which cannot be checked. filter sets the range's tab's basic filter with optional filter_columns ({ column, hide?, when?, values? }: values to hide, or a condition to show by) on a tab that has none (google_sheets_restructure's filter_replace replaces it). filter_view adds a filter view name over range with optional filter_columns; the result's filter_views lists each new view's view_id and title. chart adds a chart of range, a block or whole columns (Sales!A1:C13, Sales!A:C): its first column labels the rows, each other column is a series, and its first row is the header unless header is false; a pie chart takes two columns. chart_type (column by default, bar, line, area, scatter, combo or pie), title, legend (bottom by default, top, left, right or none), stacked (bar, column, area and combo charts), width and height in pixels are optional, and the chart sits beside the data unless at (the cell its top-left corner is on) or new_tab: true (a tab of its own) says otherwise; the result's charts lists each new chart's chart_id and title. pivot adds a pivot table of the source range (a block or whole columns with its header row): pivot_rows and pivot_columns (each a column letter, or { column, group?, sort?, label?, totals? } to group dates by a part such as YEAR_MONTH, sort desc, set a heading or hide the totals), pivot_values (at least one { column, summarize?, name? }, or { formula, summarize?, name? } with a formula such as =SUM(Amount) that names the source's columns by their header) and pivot_filters ({ column, show }, the values to keep), placed at the cell at or on a new tab with new_tab: true and an optional title (the result's created lists it). A pivot table's size is unknown until Google computes it, so one placed at at is refused when any cell from there to the tab's last row and column holds a value or a pivot table, and when that is more than 10,000 cells, which cannot be checked. metadata attaches developer metadata to the spreadsheet, a tab, or one row or column: a key (1 to 100 characters), an optional value (up to 2000) and visibility (document by default, which anyone with the file can read, or project, which only the Cloud project that made it can), and on: "spreadsheet", { tab }, or { range } of one whole row or column (Plan!5:5, Plan!C:C; Google marks one at a time); the mark moves with its row or column when it is sorted or moved, so google_sheets_edit's expect can find a row by it. The result's metadata lists each new entry's metadata_id and key. Any other operation is refused. Use google_sheets_tab_add for an empty tab, google_sheets_format for formatting and google_sheets_restructure to delete, move or merge, and to change or remove tables, rules, validation, filters, charts, pivot tables and developer metadata. A call names at most 500 ranges in all. account is needed when several accounts are set up.

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": {
      "spreadsheet": "<spreadsheet>",
      "operations": "<operations>"
    },
    "name": "google_sheets_add"
  }
}

Input Schema

NameRequiredDescriptionDefault
accountNoThe account's label. Left out, the only account is used; with several accounts, the call fails and lists them.
operationsYes1 to 100 operations, each an object with an `op` (insert, tab_duplicate, table, conditional, validate, filter, filter_view, chart, pivot, metadata) and that operation's arguments; they apply in order, and all of them land or none does.
spreadsheetYesThe spreadsheet's id, or its URL (https://docs.google.com/spreadsheets/d/<id>/…).

Output Schema

NameRequiredDescriptionDefault
tabsYesThe titles of the existing tabs that were changed, left to right.
chartsYesThe charts the call made, in the order of the operations, as Google answered: id and title.
tablesYesThe tables the call made, in the order of the operations, as Google answered: id, name and range.
appliedYesOne line per operation, in order, with its ranges as Google resolves them: what was applied.
createdYesThe tabs the call created, in the order of the operations that made them, as Google answered.
metadataYesThe developer metadata the call made, in the order of the operations, as Google answered: id and key.
requestsYesHow many requests the operations made up in the one batch.
filter_viewsYesThe filter views the call made, in the order of the operations, as Google answered.
spreadsheet_idYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A4.8/5.0
Behavior5/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Goes well beyond the annotations: it declares non-idempotence in plain terms ('applying the same operations again adds again'), assures it never removes or overwrites human-made cells, and enumerates refusal conditions (existing validation, ranges over 10,000 cells, overlapping tables, unpredictable pivot footprint). Operational limits such as 'A call names at most 500 ranges in all' are disclosed rather than left to trial and error.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness3/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The core contract (purpose, atomicity, non-idempotence) is front-loaded, but the body is one very long paragraph that re-enumerates details already in the schema, such as chart_type and legend options, condition enums, and pivot group values. Splitting per-operation paragraphs and dropping duplicated enum lists would improve scanning without losing content.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a tool with ten operation variants, an output schema, and many side constraints, the description covers what an agent needs: the operation shapes, the failure modes, ordering semantics, and the return payload keys (created, tables, charts, filter_views, metadata). Nothing material is missing for correct invocation.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters5/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100%, so the schema already documents each field, yet the description adds semantics the schema cannot express, notably ordering behavior ('a later operation's range means the cells as they stand by then') and cross-cutting constraints like the 500-range cap and the requirement of at least one pivot value. The redundant restating of enum options is a minor cost against genuinely new meaning.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

Opens with a specific verb and an enumerated resource list: 'Add rows, columns, tabs, tables, conditional rules, data validation, filters, charts, pivot tables and developer metadata to a Google spreadsheet.' It also names the siblings it is not (google_sheets_tab_add, google_sheets_format, google_sheets_restructure) and the operations each covers, so an agent can route without opening another schema.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines5/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

States when to use alternatives explicitly at the end ('Use google_sheets_tab_add for an empty tab, google_sheets_format for formatting and google_sheets_restructure to delete, move or merge'). It also clarifies the batch contract (1 to 100 operations, atomic all-or-none) and the account prerequisite, so the invocation conditions are unambiguous.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.