Spreadsheets

QUERY error: unable to parse query string in Google Sheets

Fix the Google Sheets QUERY error unable to parse query string with a checklist of causes: missing quotes, column letters versus Col1, clause order, locale.

Editorial illustration for QUERY error: unable to parse query string in Google Sheets

The message "Unable to parse query string" means Sheets could not read the text you gave QUERY as a valid query. The usual causes are missing quotes around text or dates, using column letters where the data needs Col1 names, clauses in the wrong order, and numbers written with a decimal comma. Work down the list below and fix one cause at a time.

How do I read the error message?

The full message often ends with a hint, such as a column name Sheets could not find or the word it stopped at. Look at that word first. If it names a column, check the letters. If it names a word like Swiggy, you probably forgot quotes around text.

What are the usual causes, with fixes?

CauseBrokenFixed
Text without quotes"select A, C where B = Swiggy""select A, C where B = 'Swiggy'"
Date without the date keyword"select A where A > 2025-04-01""select A where A > date '2025-04-01'"
Letters on a stacked arrayQUERY({A1:C10;A1:C10}, "select A")QUERY({A1:C10;A1:C10}, "select Col1")
Clauses in wrong order"select B, sum(C) order by sum(C) group by B""select B, sum(C) group by B order by sum(C)"
Column outside the rangeQUERY(A1:C500, "select D")QUERY(A1:D500, "select D")
Decimal comma from a cell"where C > "&G1 with 1,5"where C > "&SUBSTITUTE(G1,",",".")
Aggregate not grouped"select B, C, sum(C) group by B""select B, sum(C) group by B"

Is the clause order wrong?

The query language reads clauses in a fixed order: select, where, group by, pivot, order by, limit, offset, label, format. Swapping any two can trigger the error. Write them in that order and keep each clause on its own mental line.

Do I need column letters or Col1?

  • Use letters when the range is a plain reference such as A1:D500.
  • Use Col1, Col2, Col3 when the data is an array built with curly brackets, a function such as FILTER, or IMPORTRANGE.
  • If you move a query between the two, remember to rewrite every column reference, including those inside label and order by.

Why does it fail only when a cell changes?

Queries that join in cell values can be fine until someone types something awkward. A merchant name with an apostrophe closes the single quote early. A blank cell leaves a condition like where B = '' that is valid but returns nothing, or a number condition with nothing after it that is invalid. A date cell not wrapped in TEXT inserts a serial number such as 45748 instead of a date string. Test the formula with empty and unusual values, and wrap risky joins in IFERROR to catch them.

  • Column not found or a NO_COLUMN message: the range does not contain the column you named.
  • Query completed with an empty output: the query is valid, but no row matched.
  • A message about an array literal missing values: the stacked ranges in curly brackets have different widths.
  • An aggregation error: you mixed plain columns and sum(), count() or avg() without grouping.

A final checklist

  1. Does the whole query sit inside one pair of double quotes?
  2. Is every text value inside single quotes?
  3. Are dates written as date 'yyyy-mm-dd'?
  4. Do all column names exist in the range, as letters or Col numbers?
  5. Are the clauses in the right order?
  6. Is every non-aggregated column in select also in group by?

A worked example: select B, sum(C) where B <> 'Cash' group by B order by sum(C) desc. Every text value has single quotes, the order is select, where, group by, order by, and B is in group by. If that fails, the likely issue is the range, not the syntax.

If you would rather not debug query text, SpendixAI offers ready-made reports and a report builder over imported statements, which can be easier than writing the same grouping by hand.

SPENDIXAI JOURNAL

Useful ideas start with a clearer picture of your own spending.

Explore your reports