Google-sheets – Using Google Sheets cell reference in SOQL Query

google sheetssalesforce

I'm using Data connector for Salesforce Google Sheets add-on to pull Salesforce information into a sheet via SOQL queries.

I'd like to use a cell reference from my sheet inside one of those queries, but have not found proper documentation on how to do so. Here's examples of what I've tried thus far:

SELECT AccountOwner FROM Account WHERE AccountName = '[Sheet1!A1]' 

This returns 0 query results, even though the data in cell A1 is a valid AccountName.

SELECT AccountOwner FROM Account WHERE AccountName = '"&Sheet1!A1&"' 

Again same results as before.

Would anyone be able to provide more insight on how to utilize a cell reference here? Thank you!

Best Answer

Figured out a workaround at least for my use case. There doesn't seem to be a way to use local references in these queries that I can figure out, but you can import your full set of data into separate tabs of the sheet (One SF object per tab is what imports), and then use the native sheets QUERY function to pull information out of those tabs as necessary https://support.google.com/docs/answer/3093343?hl=en

This thread then shows proper formatting for cell references in these queries https://stackoverflow.com/questions/23427421/query-syntax-using-cell-reference