retinanets
retinanets

Reputation: 21

Google Sheets API querying - can you query multiple sheets at once?

I'm looking to create a searchable database from a Google Spreadsheet.

I've looked into what the API can do and I know you can query a sheet according to the gid ID. What I want to know is whether it is possible to query (so return matching search data) across the whole of a spreadsheet which has multiple sheets (and therefore multiple gids)?

Upvotes: 0

Views: 2756

Answers (1)

Ed Nelson
Ed Nelson

Reputation: 10269

Assuming your data is in Sheet1 and Sheet2 and the id is in column A (of both sheets), in Sheet3 enter the id to search for in A1 and the following in cell B1:

=query({Sheet1!A2:D;Sheet2!A2:D},"Select Col2,Col3,Col4 where Col1 <>'' AND Col1 = '" &A1&"'")

Upvotes: 1

Related Questions