files_set_pivot_table
Creates or reconfigures a PivotTable: a live cross-tabulation that groups source rows by fields and aggregates values per group; it recomputes when the source changes and exports to Excel as a real PivotTable. action='create' needs source (an A1 range whose first row is headers, e.g. 'A1:E500', or a table name) and at least one values entry; destination is 'new_sheet' (default) or a top-left cell like 'F1'. action='update' needs pivot_table_name (from files_context) and applies a merge: null leaves an area unchanged, an empty array clears it. Reference source columns by header name. rows/columns entries: {field, label?, sort? (ascending|descending|source_order), show_totals?, group_by? (seconds|minutes|hours|days|day_of_week|months|quarters|years), numeric_interval?}. values entries: {field, aggregation? (sum|count|count_numbers|distinct_count|average|median|max|min|product|stddev|stddevp|var|varp), name?, show_as? (percent_of_row_total|percent_of_column_total|percent_of_grand_total|running_total_in_rows|...|index)}. filters entries: {field, include?, exclude?}. Requires edit permission. Signature: files_set_pivot_table(file_uuid, action, pivot_table_name?, sheet?, source?, destination?, rows?, columns?, values?, filters?, layout?, values_layout?, row_grand_total?, column_grand_total?, subtotal_position?).
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": {
"file_uuid": "<file_uuid>",
"action": "<action>"
},
"name": "files_set_pivot_table"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| rows | No | Row area fields, outermost first. Null keeps, [] clears. | |
| sheet | No | Sheet the source data is on (defaults to the first sheet). | |
| action | Yes | 'create' or 'update'. | |
| layout | No | 'compact' (default), 'outline', or 'tabular'. | |
| source | No | Create only. A1 range with headers in the first row, e.g. 'A1:E500', or a table name. | |
| values | No | Aggregated value fields. Null keeps, [] clears; a report needs at least one. | |
| columns | No | Column area fields. Null keeps, [] clears. | |
| filters | No | Filter fields restricting source rows. Null keeps, [] clears. | |
| file_uuid | Yes | ||
| destination | No | Create only. 'new_sheet' (default) or a top-left cell, e.g. 'F1'. | |
| values_layout | No | 'across_columns' (default) or 'down_rows'. | |
| row_grand_total | No | Grand total column. Default true. | |
| pivot_table_name | No | Report to update (from files_context). For create — optional name for the new report. | |
| subtotal_position | No | 'top' (default) or 'bottom'. | |
| column_grand_total | No | Grand total row. Default true. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| created | No | ||
| updated | No | ||
| file_uuid | Yes | ||
| pivot_table | No | ||
| sequence_number | Yes | ||
| pivot_table_name | No |