QUERY Function in Google Sheets

Run a Google Visualization API Query Language query on the data using the QUERY function.

QUERY Function

The QUERY function in Google Sheets is used to run a Google Visualization API Query Language query on the provided data.

Syntax

QUERY(data, query, [headers])
  • data: The range of cells containing the data you want to query. This is a required parameter.
  • query: The query string written in Google Visualization API Query Language. This is a required parameter.
  • headers: (Optional) The number of header rows at the top of the data range.

Example

  1. Basic Query

Select all rows where column A has a value greater than 10:

=QUERY(A1:C10, "SELECT * WHERE A > 10")

This will return rows where the value in column A is greater than 10.

Notes

  • The function allows complex data manipulation within Google Sheets using SQL-like syntax.
  • FILTER: Filter a range of data based on criteria.