aggregate
Group and summarize spreadsheet data with pivot-style metrics, filters, and sorting. Aggregate xlsx, csv, parquet, or json files into grouped tables or saved report files.
Instructions
Group-by summaries and pivot tables (like Excel PivotTables) over xlsx/csv/parquet/json.
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": {
"source": "<source>",
"metrics": "<metrics>"
},
"name": "aggregate"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| limit | No | Max rows to return (default from server config, usually 100). | |
| sheet | No | Sheet name (or 0-based index). Default: first sheet. | |
| where | No | SQL filter applied before grouping. | |
| format | No | json = rows as arrays, records = list of objects, markdown = a table. | json |
| having | No | SQL filter on groups, e.g. 'sum_amount > 1000'. | |
| output | No | Save the FULL result to this file (.xlsx/.csv/.parquet/.json/.md) instead of returning rows. | |
| source | Yes | Data file; for a specific sheet use 'book.xlsx#Sheet1' or the sheet parameter. | |
| metrics | Yes | e.g. ['amount:sum', 'amount:avg', 'customer:count_distinct', 'count'] or SQL like 'sum(qty*price) AS revenue'. Funcs: sum avg min max count count_distinct median std var first last. | |
| group_by | No | Columns to group by. | |
| order_by | No | Sort results. | |
| pivot_on | No | Make a pivot table: one output column per distinct value of this column. | |
| output_sheet | No | When output is an existing .xlsx: write into this sheet (replaced if it exists), keeping other sheets. |