Articles on: PostgreSQL and MySQL

Pull dynamic values from Google Sheets in your Postgres or MySQL query

SyncWith for Google Sheets has a feature called Cell References which you can use in an SQL query to pull value(s) from your sheet. This can be useful to pull dynamic values that might change, for example a date.

Cell references can reference a single cell, or a row or column range of cells, or a named range.

Example cell reference syntax:
{{Sheet1!A1}}
{{'Sheet name'!A1:A2}}
{{NameOfYourNamedRange}}

Here's an example of using one in your SQL:

SELECT * FROM table_name WHERE field_name = '{{Sheet1!A1}}'


Note: SyncWith does a simple string replacement, so you're still responsible for ensuring the SQL is valid once we've replaced the cell reference value, eg if its a string it will likely need quotes

Updated on: 02/21/2024

Was this article helpful?

Share your feedback

Cancel

Thank you!