Search code examples
google-sheetsgoogle-query-language

"Formula parse error" when querying different document


I am attempting to have a cell in Sheet B display data from a cell in External / Remote Sheet A, but it results in "Formula parse error." (ETA detail to aid searches: displaying data in one Google Spreadsheet from a different Google Sheet.)

My query: =Query(SheetA,sheet1!A:I,"select I WHERE A=3")

I've also tried it this way: =Query(SheetA,sheet1!$A:$I,"select I WHERE A=3",-1)


Solution

  • This answer courtesy of @AdamL (thank you, sir!). This was his answer that I found does work very well. When QUERY isn't directly referencing a range in the same spreadsheet, use Colx notation rather than column letters:

        =QUERY(importrange("NameofGoogleSheet","SheetTabName!A:Z"),"select Col9 where Col1=3") 
    

    If referencing dynamically, use something like:

    =QUERY(importrange("NameofGoogleSheet","SheetTabName!A:Z"),"select Col9 where Col1="&D19)

    It is also important to note that you must first connect the sheets to each other. Until this is done, you will get column errors, etc. This is done by selecting a cell of the sheet that will display the data, and putting in an IMPORTRANGE on it, which opens a dialog for connecting them. More info: https://support.google.com/docs/answer/3093340?hl=en

    I also realized (duh) that I was being stupid to have two separate files for each. I only need two sheets within the same document; 1 to serve as the database and the other to display the formatted data. I am using this for a pedigree application.