lucky1928
lucky1928

Reputation: 8841

Google Sheets - Query Malfunction

Say I have Sheet 2 data as below:

|----+----|
| A1 | B1 |
|----+----|
| A2 | B2 |
|----+----|
| A3 | 3  |
|----+----|

I want to use query to show it in Sheet 1 with below command:

=query(Sheet2!A:B)

But row 1 and 2 are merged together like the following table

|-------+-------|
| A1 A2 | B1 B2 |
|-------+-------|
| A3    |     3 |
|-------+-------|

If I change the number in B3 from "3" to "B3", then it works just fine. That means if it's a number, query API will not work as expected.

Is it a query API problem or my mistake?

Upvotes: 0

Views: 60

Answers (1)

JPV
JPV

Reputation: 27262

Try using the optional headers argument in QUERY. e.g:

=query(Sheet2!A:B,,1)

Alternatively use:

=index(Sheet2!A:B)

or

={Sheet2!A:B}

Upvotes: 1

Related Questions