Category: Datasources
Updated

This solution is summarized from an archived support forum post. This information may have changed. If you notice an error, please let us know in Discord.

How to Query Google Sheets Based Table Specifying a Certain Column to Search

Issue

I am trying to figure out how to search for a specific column in a Google Sheets table. I need to be able to query the table based on a column name.

Resolution

To query a specific column in a Google Sheets table, you can use the QUERY function. The basic syntax is:

=QUERY(table_range, "SELECT * WHERE [column letter] = 'search term'")	

Example 1:

If you want to search for all rows where the values in column C equal "apple", you would use the following formula:

=QUERY(A:C, "SELECT * WHERE C = 'apple'")

This will return all rows in the table that have "apple" in column C.

Example 2:

You can also use comparison operators like >, <, >=, <= to filter values. For example, if you want to find all rows where column B has values greater than 100, use the formula:

=QUERY(A:C, "SELECT * WHERE B > 100")

This will return all rows where the values in column B are greater than 100.

Additional Functions:

You can use functions like COUNT, SUM, AVERAGE, etc., within the QUERY function to perform calculations on the filtered rows.