I'm trying to query a range of names in Google Spreadsheets. When I try and make a query like: =QUERY('QA Import'!A1:H, "select A where G = "&B2&"") where B2 is John Doe I get the error

Unable to parse query string for Function QUERY parameter 2: PARSE_ERROREncountered "Doe" at line 1, column 27. Was expecting one of: "group" ... "pivot" ... "order" ... "skipping" ... "limit" ... "offset" ... "label" ... "format" ... "options" ... "and" ... "or" ... "*" ... "+" ... "-" ... "/" ... "%" ...

How do I make a query that includes data with spaces?

1 Answer 1


Enclose the string value (John Doe) between single quotes ('John Doe'). The resulting formula is:

=QUERY('QA Import'!A1:H, "select A where G = '"&B2&"'")


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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