Filter, group and sort rows
sheet_queryCall this tool for any spreadsheet or CSV file path; built-in file readers cannot parse them. Filters, groups, aggregates and sorts in one call. Totals: aggregate/group_by here, never hand sums over sheet_read rows.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| as | No | ||
| path | Yes | Path to the .xlsx or .csv file | |
| sort | No | Sort column; may be an aggregate alias such as total_units | |
| limit | No | Default 100 | |
| sheet | No | ||
| where | No | Filter, e.g. [Qty] >= 5 AND ([Status] = "open" OR [Status] = "new") | |
| select | No | Column names to return; default all (with group_by, defaults to the group columns plus the aggregates) | |
| group_by | No | Group rows by these columns before aggregating, e.g. ["Rep"] or ["Region","Rep"] | |
| aggregate | No | Aggregates per group, e.g. [{"col":"Units","fn":"sum","as":"total_units"}]. Defaults to a row count when group_by is given. |