Skip to main content
Glama

create_pivot_table

Create a pivot table in Excel from a specified data range, organizing data by row and column fields with chosen aggregation functions.

Instructions

Create pivot table in worksheet.

Args:
    sheet_name: Name of worksheet containing source data
    data_range: Source data range (e.g., "A1:E100" or "Sheet2!A1:E100")
    rows: Field names for row labels
    values: Field names for values
    session_id: Session ID from open_workbook (preferred)
    filepath: Path to Excel file (legacy, deprecated)
    columns: Field names for column labels (optional)
    agg_func: Aggregation function (sum, count, average, max, min)
    target_sheet: Target sheet for pivot table (optional, auto-created if not exists)
    target_cell: Target cell for pivot table (optional, finds empty area if not provided)
    pivot_name: Custom name for pivot table (optional, auto-generated if not provided)
    
Note: Use session_id for better performance. filepath parameter is deprecated.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
sheet_nameYes
data_rangeYes
rowsYes
valuesYes
session_idNo
filepathNo
columnsNo
agg_funcNomean
target_sheetNo
target_cellNo
pivot_nameNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes
Behavior4/5

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

No annotations provided, so description carries the behavioral disclosure burden. It notes that session_id is preferred over filepath (deprecated), explains auto-creation of target_sheet, auto-finding of target_cell, and auto-generation of pivot_name. However, it does not explicitly state that this operation modifies the workbook or require permissions.

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 structured as a clear bullet list with each parameter explained in one line. It is concise without fluff, though the 'Args:' prefix is slightly redundant. Still well-organized and front-loaded.

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 11 parameters, 4 required, no annotations, and an output schema exists, the description covers all parameter behaviors adequately. It does not explain return values, but that is mitigated by the output schema presence.

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 description coverage is 0%, so the description fully explains each parameter's meaning, including optionality, defaults, deprecation of filepath, and examples for data_range. This is critical value-added 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 explicitly states 'Create pivot table in worksheet', a specific verb-resource combination. It distinguishes from sibling tools like create_chart and create_table by focusing on pivot table creation.

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 provides parameter explanations but no explicit guidance on when to use this tool versus alternatives like create_table or apply_formula. Usage context is implied by the parameter list, but no when-not-to-use or prerequisite conditions are mentioned.

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/fastmcp-me/xlwings-mcp-server'

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