Skip to main content

Sheet Variables

A sheet variable is a cell in a specific sheet whose value is used in a query.


Create a query like usual, but when writing your SQL query, you may use the sheet variable format: {{ cell }}, where cell is the location of a cell in the same worksheet in the schedule that the query will run (for example, A1).

If there are no variables in the query, the query will run like usual.


  • The value from the cell is queried on every run of the schedule associated with the query, so everything is up to date. You can update the value in the cell on the fly, without having to edit the query.
  • You can have multiple variables in a query. For example, SELECT * FROM table WHERE id={{ A1 }} AND age > {{ A2 }} is valid.


  • The data type in a cell is important. This is usually set automatically, but it is recommended that you manually set the cell data type to prevent any formatting errors. It is recommended that dates are in plain text, otherwise Google Sheets automatically converts this into an unwanted value for formatting. Other types (numbers, booleans, and plain text) are handled as expected.

Sheet Variables

  • Value escaping/quoting is handled automatically, you do not need to insert your own quotations.

Note that the variable format is not affected by whitespace; for example, {{ cell }} is functionally equivalent to {{ cell}} and {{cell}}.