Currently I use Google Sheets as a database, which has more than 1000 columns from A to AGH. If the query contains column BY or column OR, the result will be null.
How can I avoid that column names cannot be mixed with query commands (by and or) ?
As written in official documentation:
Identifiers (or IDs) are text strings that identify columns.
Important: If your identifier
Has spaces,
Is a reserved word,
Contains anything but alphanumeric characters or underscores ([a-zA-Z0-9_]), or
Starts with a digit
it must be surrounded by back-quotes (not single quotes).
=QUERY(BY1:BY4,"SELECT `BY`",0)
Alternatively, {}
removes the range references and only puts the values, which can be referenced with Col
numbers.
=QUERY({BY1:BY4},"SELECT Col1",0)