2
votes

Trying to run this query:

=query(IMPORTRANGE("XXXXXXX","'XX'!A:H"), "where Col3 = '666' and select Col1, Col2, Col3, Col4, Col5, Col6, Col7, Col8 and order by Col5 desc",1)

And keep on getting weird errors such as this one

Unable to parse query string for Function QUERY parameter 2: PARSE_ERROR: Encountered " "select" "select "" at line 1, column 24. Was expecting one of: "true" ... "false" ... "not" ... "date" ... "timeofday" ... "datetime" ... "timestamp" ... "min" ... "max" ... "avg" ... "count" ... "sum" ... "no_values" ... "no_format" ... "is" ... "null" ... "year" ... "month" ... "day" ... "hour" ... "minute" ... "second" ... "millisecond" ... "with" ... "contains" ... "starts" ... "ends" ... "matches" ... "like" ... "now" ... "dateDiff" ... "quarter" ... "lower" ... "upper" ... "dayOfWeek" ... "toDate" ... ... <INTEGER_LITERAL> ... <DECIMAL_LITERAL> ... <STRING_LITERAL> ... <QUOTED_ID> ... "(" ... "-" ...

Not sure why the error is referring to column 24 where I clearly didn't ask for it :)

Any thoughts?

1
Column24= character 24. First character is w from where. Select cannot come after where.TheMaster

1 Answers

3
votes

should be:

=QUERY(IMPORTRANGE("XXXXXXX", "'XX'!A:H"), 
 "select Col1,Col2,Col3,Col4,Col5,Col6,Col7,Col8 
  where Col3 = '666'
  order by Col5 desc", 1)