Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
177 views
in Technique[技术] by (71.8m points)

In gsheets how do I pull data from multiple sheets within the workbook in a query?

This is what I have so far. It worked fine before adding in the BinCounts ref.

=query(
{'Aggregated Data'!A2:G , BinCounts!A2:G}, "SELECT A, B, C, E, DAY(B), YEAR(B)" & if(COUNTBLANK(Sheet14!A1:A4)=4,""," WHERE " & TEXTJOIN(" AND ", True, Sheet14!A1:A4) & "WHERE Col1 <>"),1)
question from:https://stackoverflow.com/questions/65904737/in-gsheets-how-do-i-pull-data-from-multiple-sheets-within-the-workbook-in-a-quer

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

You should use ; instead of , in between multiple sheets.

Query should look like this:

=query( {'Aggregated Data'!A2:G; BinCounts!A2:G}, "SELECT A, B, C, E, DAY(B), YEAR(B)" & if(COUNTBLANK(Sheet14!A1:A4)=4,""," WHERE " & TEXTJOIN(" AND ", True, Sheet14!A1:A4) & "WHERE Col1 <>"),1)

Sample query that queries multiple sheets.

sample query

Reference:


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...