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
| Name | Required | Description | Default |
|---|---|---|---|
| sheet_name | Yes | ||
| data_range | Yes | ||
| rows | Yes | ||
| values | Yes | ||
| session_id | No | ||
| filepath | No | ||
| columns | No | ||
| agg_func | No | mean | |
| target_sheet | No | ||
| target_cell | No | ||
| pivot_name | No |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |