Skip to main content
Glama
nityeshaga

google-workspace-mcp-server

by nityeshaga

Create Pivot Table

sheets_create_pivot_table

Create a pivot table from spreadsheet data, specifying row/column groupings, value aggregations, filters, and date or numeric bucketing options.

Instructions

Create a pivot table from spreadsheet data with full Google Sheets UI feature support.

Args:

  • spreadsheet_id (string): The ID of the Google Spreadsheet

  • source_range (string): A1 notation range (e.g., 'Sheet1!A1:E100', 'Sales!A:F')

  • destination_sheet_id (number, optional): Sheet ID for pivot (default: creates new sheet)

  • destination_sheet_name (string): Name for new sheet (default: 'Pivot Table')

  • rows/columns (array): Groupings (at least one row OR column required)

    • source_column: Column letter ('A') or index (0)

    • label: Custom display name

    • show_totals: Show subtotals (default: true)

    • sort_order: 'ASCENDING' or 'DESCENDING'

    • sort_by_value: { value_index: 0 } - Sort by aggregated value instead of alphabetically

    • group_rule: Bucketing options (pick one):

      • { date_time: { type: 'MONTH' } } - Group dates (YEAR, QUARTER, MONTH, DAY_OF_WEEK, etc.)

      • { histogram: { interval: 100, start: 0, end: 1000 } } - Numeric buckets

      • { manual: { groups: [{ group_name: 'West', items: ['CA', 'WA', 'OR'] }] } }

    • group_limit: Max groups to display

  • values (array, required): Aggregations

    • source_column: Column to aggregate (or use formula)

    • formula: Custom formula like '=Revenue/Quantity' (use with summarize_function: 'CUSTOM')

    • summarize_function: SUM, COUNT, COUNTA, COUNTUNIQUE, AVERAGE, MAX, MIN, MEDIAN, PRODUCT, STDEV, STDEVP, VAR, VARP, CUSTOM

    • name: Display name

    • calculated_display_type: 'PERCENT_OF_ROW_TOTAL', 'PERCENT_OF_COLUMN_TOTAL', 'PERCENT_OF_GRAND_TOTAL'

  • filters (array, optional): Filter source data

    • source_column: Column to filter

    • visible_values: ['Active', 'Pending'] - Show only these values

    • condition: { type: 'NUMBER_GREATER', values: [100] } - Filter by condition

  • value_layout: 'HORIZONTAL' or 'VERTICAL' (default: 'HORIZONTAL')

Examples:

  • Date grouped: rows=[{source_column: "A", group_rule: {date_time: {type: "MONTH"}}}], values=[{source_column: "E", summarize_function: "SUM"}]

  • Sorted by value: rows=[{source_column: "A", sort_by_value: {value_index: 0}, sort_order: "DESCENDING"}], values=[{source_column: "E", summarize_function: "SUM"}]

  • Filtered: filters=[{source_column: "B", visible_values: ["Active"]}], rows=[{source_column: "A"}], values=[{source_column: "E", summarize_function: "SUM"}]

  • Percentage: values=[{source_column: "E", summarize_function: "SUM", calculated_display_type: "PERCENT_OF_GRAND_TOTAL"}]

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Behavior3/5

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

Annotations declare mutation and non-idempotency, but the description adds only a bit more context: it mentions that omitting destination_sheet_id creates a new sheet. It does not disclose other side effects, permissions, or potential impacts on the spreadsheet beyond the new sheet.

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

Conciseness4/5

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

The description is long but extremely well-structured with sections for arguments and examples. Each sentence serves a purpose, and the examples clarify complex nested parameters. The length is justified by the tool's complexity, though a brief summary line could improve scannability.

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

Completeness4/5

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

Given the tool's high complexity, the description is remarkably complete: it covers all parameter details, defaults, supported enum values, and edge cases. However, it does not describe the return value or output, nor does it mention prerequisites like whether the spreadsheet must already exist, leaving a small completeness gap.

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?

The input schema is empty, so the description carries the full burden of explaining parameters. It excels: every argument is documented with types, defaults, enums, and nested structures, plus multiple concrete examples. This adds immense meaning beyond the schema.

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?

The description clearly states 'Create a pivot table from spreadsheet data', which is a specific verb and resource. It also notes 'full Google Sheets UI feature support', distinguishing it from other Sheets tools like sheets_get_values or sheets_batch_update.

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

Usage Guidelines3/5

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

The description implies usage by detailing every parameter and providing examples, but it does not explicitly state when to use this tool versus alternatives (e.g., when a pivot table is needed as opposed to a simple range update). No exclusions or alternative tool mentions are present.

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

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/nityeshaga/google-workspace-mcp-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server