QUERY

Filter and transform data from a range of cells using an SQL-like language.

Parameter List

Syntax
QUERY(dataquery
[headers]
)
data

The range or {data} cell from where data is to be read.

query

The query language that will select and transform the data. For example: "select *", "select B,A where B>2". Supports:

  • Selections with SELECT

  • Mathematical operations with SUM, MIN, MAX, AVERAGE,COUNT

  • Conditional clauses with WHERE

  • Aggregations with GROUP BY

  • Sorting with ORDER BY

    Read the guide on QUERY.

[optional] headers

Number corresponds to the rows that are part of the header. Default is 1, meaning that the first row is the header of the table.

Examples

QUERY(A1:D4, "select * where B>2") returns Returns all rows from the data range where the values on column B > 2.