edit_pivot
Modify an existing pivot's grouping, measures, order, or filters while keeping its ref name and formulas intact. Use it to repair broken pivots that read 0 instead of erroring.
Instructions
Change an existing pivot's recipe — what it groups by, what it measures, how, in what order, over which records — and reshape it to match.
Use this rather than deleting and recreating: the block keeps its ref name, so every formula pointing at it keeps working, and the whole change is one undo.
This is also the way to REPAIR a pivot whose recipe stopped resolving (describe_block reports pivot_is_broken) — for instance after a source field was renamed. A broken pivot reads 0 in every cell rather than erroring, so it must be fixed, not refreshed: a refresh fails the same way.
Everything you omit is UNCHANGED. What you pass replaces that part outright — filters: [] clears the filters, columns: null turns a cross-tab into a simple group-by.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| func | No | New aggregate. Omit to keep the current one. | |
| name | Yes | Ref name of the pivot block. | |
| rows | No | New row dimension. Its values must repeat. Omit to keep the current one. | |
| order | No | New row order. Omit to keep the current one. | |
| columns | No | New column dimension. Pass null to drop the columns and make it a simple group-by. Omit to keep the current one. | |
| filters | No | Replaces the current filters outright. Pass an empty array to count every record again. | |
| measure | No | New field to aggregate. Omit to keep the current one. | |
| row_total | No | Name for a column totalling each row across every column value. Replaces the declared columns along with `extra_measures`. | |
| order_values | No | The row sequence for `order: custom`. | |
| extra_measures | No | Replaces the declared extra columns outright, together with `row_total`. Omit BOTH to keep the ones the pivot has. |