简体   繁体   中英

Is there a list of column references that will break query functions in Google Sheets? (column BY, OR)

I am using column references in a Google Sheets query and realized that column BY (Col #77) breaks my query, as BY is a special word in querying. The solution is to enclose BY in quotations (`BY`) within the query. Today I realized that OR (Col #408) was breaking my query as well. Is there a way I can identify what these words are ahead of time? I'm guessing column AND is also problematic.

Thanks!

see: https://developers.google.com/chart/interactive/docs/querylanguage#Reserved_Words

so, as per documentation, you will need to backquote only these 5:

`BY`
`OR`
`AND`
`ASC`
`NOT`

在此处输入图像描述

In your situation, enclose the area with curly brackets and use ColX.

Example, replace =query(A:BY,"select A, BY") by =query({A:BY},"select Col1, Col77")

Note that x is not an absolute value but relative to the virtual matrix, ie =query({BX:BX,BY:BY,OR:OR},"select Col2, Col3 where Col1 is not null")

Mike's answer is a great workaround to this but if you're still looking for a list you can refer to the Google Sheets function list and their Query Language Reserved Words reference, so you can have an idea of what words are reserved in Sheets.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM