I’m having a problem with the =QUERY(IMPORTRANGE()) formula while retrieving a column data from one spreadsheet to another.

=QUERY(IMPORTRANGE("spreedsheetURL","Sheet1!A2"),"select Col2 WHERE Col1 Contains B3")

I want to retrieve data from the column2 spreadsheet(A) to column2 spreadsheet(B) where column1 spreadsheet(A) is equal to the column1 spreadsheet(B).

The error I get is:

Formula parse error.

  • 1
    pls, share a sheet too – user0 Feb 7 '19 at 10:34

=QUERY(IMPORTRANGE("URL"; "Sheet1!A2:B"); "select Col2 where Col1 contains '"&B3&"'"; 0)

| improve this answer | |
  • 1
    This answer was flagged as low-quality because of its length and content. – Rubén Feb 7 '19 at 19:07
  • Please add a brief description of the formula and image. – Rubén Feb 7 '19 at 19:14

Maybe the error "Formula parse error" occurs because your spreadsheet use semicolon as argument separator instead of comma. Replace the commas by semicolons (;)

It's not possible to directly compare to a cell by including the cell address into the SQL argument of QUERY. Also there is no Col2 in Sheet!A2, this is referring to only once cell. If this is correct instead of QUERY use IF

=IF(IMPORTRANGE("spreedsheetURL","Sheet1!A2") = B3, "spreedsheetURL","Sheet1!A2") , )

If you want to retrieve whole column A, instead of "Sheet1!A2" use "Sheet1!A:A"

Assuming Sheet1!A:A and B3 contains numbers, the formula to use should be

=QUERY(IMPORTRANGE("spreedsheetURL","Sheet1!A:A"),"select Col1 WHERE Col1 Contains "&B3)

Assuming Sheet1!A:A and B3 contains text, the formula to use should be

=QUERY(IMPORTRANGE("spreedsheetURL","Sheet1!A:A"),"select Col1 WHERE Col1 Contains '"&B3&"'")
| improve this answer | |
  • Col2 cant be found in range A:A – user0 Feb 7 '19 at 18:13
  • You are right. Thanks – Rubén Feb 7 '19 at 18:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.