I have a problem with the following QUERY code in Google Sheets. All rows work fine accept the first row. Column BY crashes the code. When i change the column to BZ it works fine, but that's not the data i need. What am i doing wrong?
The error i get:
Error In ARRAY_LITERAL, an Array Literal was missing values for one or more rows.
QUERY({
QUERY('Form Responses 1'!$A$2:$CS$1051, "select A, BR, E, F, BT, BY, I, H");
QUERY('Form Responses 1'!$A$2:$CS$1051, "select A, BJ, E, F, BL, BQ, I, H");
QUERY('Form Responses 1'!$A$2:$CS$1051, "select A, BB, E, F, BD, BI, I, H");
QUERY('Form Responses 1'!$A$2:$CS$1051, "select A, AT, E, F, AV, BA, I, H");
QUERY('Form Responses 1'!$A$2:$CS$1051, "select A, AL, E, F, AN, AS, I, H");
QUERY('Form Responses 1'!$A$2:$CS$1051, "select A, AD, E, F, AF, AK, I, H");
QUERY('Form Responses 1'!$A$2:$CS$1051, "select A, V, E, F, X, AC, I, H");
QUERY('Form Responses 1'!$A$2:$CS$1051, "select A, N, E, F, P, U, I, H")
},"select Col1, Col2, Col3, Col4, Col5, Col6, Col7,Col8 WHERE Col2 is not null ORDER BY Col1")
The BY
is a keyword for the query language. You have to escape it to use it as a parameter of your query. Use the backquote (`) symbol to escape the column name in your query formula:
=QUERY({
QUERY('Form Responses 1'!$A$2:$CS$1051, "select A, BR, E, F, BT, `BY`, I, H");
QUERY('Form Responses 1'!$A$2:$CS$1051, "select A, BJ, E, F, BL, BQ, I, H");
QUERY('Form Responses 1'!$A$2:$CS$1051, "select A, BB, E, F, BD, BI, I, H");
QUERY('Form Responses 1'!$A$2:$CS$1051, "select A, AT, E, F, AV, BA, I, H");
QUERY('Form Responses 1'!$A$2:$CS$1051, "select A, AL, E, F, AN, AS, I, H");
QUERY('Form Responses 1'!$A$2:$CS$1051, "select A, AD, E, F, AF, AK, I, H");
QUERY('Form Responses 1'!$A$2:$CS$1051, "select A, V, E, F, X, AC, I, H");
QUERY('Form Responses 1'!$A$2:$CS$1051, "select A, N, E, F, P, U, I, H")
},"select Col1, Col2, Col3, Col4, Col5, Col6, Col7,Col8 WHERE Col2 is not null ORDER BY Col1")