Skip to main content
Glama
EveryInc

google-workspace-mcp-server

by EveryInc

Create Pivot Table

sheets_create_pivot_table

Create a pivot table in Google Sheets by specifying source data range, row/column groupings, value aggregations, and filters. Supports date grouping, sorting, calculated fields, and custom display types.

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

Behavior4/5

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

Annotations indicate readOnlyHint=false and destructiveHint=false, and the description adds that the tool creates a new pivot table (non-destructive write). It provides detailed behavioral context for parameters and examples, though it doesn't discuss permissions or side effects beyond creation.

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 well-structured with sections for args and examples, and is front-loaded with purpose. However, it is lengthy and could be slightly more concise by removing redundant phrasing while retaining completeness.

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?

Given the complexity of pivot tables and the absence of an output schema, the description covers all necessary information: parameters, examples, and behavior. It is complete enough for an AI agent to correctly invoke the tool.

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 bears full responsibility for parameter documentation. It provides detailed explanations for each parameter, including types, defaults, options (e.g., summarize_function enums), and nested object structures, with multiple examples demonstrating usage.

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 explicitly states 'Create a pivot table from spreadsheet data', which is a specific verb+resource. It distinguishes itself from sibling tools like sheets_get_values or sheets_batch_update by focusing on pivot table creation, a unique operation among the siblings.

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

Usage Guidelines4/5

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

The description clearly indicates when to use this tool (to create a pivot table) and provides extensive parameter details. However, it does not explicitly state when not to use it or mention alternative tools for raw data retrieval, which would enhance guidance.

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/EveryInc/google-workspace-mcp-server'

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