query_range
Read only the spreadsheet rows and columns you need by filtering, sorting, paginating, and aggregating ranges server-side before retrieval.
Instructions
Filter, project, sort, paginate, and aggregate a range SERVER-SIDE so an agent reads only the rows and columns it needs instead of a whole sheet.
location defaults to the sheet's true used range. With header=true the first row names the columns (referenced by name; otherwise by A1 letter). where is a list of {column, op, value} predicates joined by match ('all' or 'any'); ops: eq, ne, gt, ge, lt, le, contains, startswith, endswith, regex, in, not_in, is_blank, not_blank. columns projects a subset; order_by is a list of {column, dir} specs (unknown directions refuse); offset and limit page; distinct dedupes. aggregate is a list of {column, func} (count, count_nonblank, count_distinct, sum, avg, min, max, first, last), optionally per group_by, returning group summaries (records=true emits objects).
Semantics: predicates read CACHED and literal values (uncalculated formulas read as blank; recalc for exact results); gt/ge/lt/le compare numerically when both sides coerce, else case-folded text; blanks never satisfy ordered comparisons; regex is timeout-guarded. Aggregates follow Excel: sum/avg/min/max consume NUMERIC cells only (text and booleans ignored even when text looks numeric; exclusions are reported); count is the RAW row count, unlike Excel COUNT; min/max fall back to text when no numbers exist. Read-only.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| path | Yes | ||
| limit | No | ||
| match | No | all | |
| sheet | No | ||
| where | No | ||
| header | No | ||
| offset | No | ||
| values | No | cached | |
| columns | No | ||
| records | No | ||
| distinct | No | ||
| group_by | No | ||
| location | No | ||
| order_by | No | ||
| aggregate | No |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||