Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Google Spreadsheets QUERY() to combine multiple sheets, same workbook

Tags:

People also ask

Can I merge two Google Sheets?

Connect your Google account and select a Google Sheets file on your Google Drive to transfer data from. Then select the sheets to merge.


Goal: I'm using QUERY() in gSheets to combine data from multiple sheets in the same workbook. The data is an extract from GA broken down into small segments to prevent sampling. This means it has all the same fields, I'm just piecing it back together for analysis.

I would like to use QUERY() to do this because the data is hooked up to auto-update using the Google Analytics Sheets addon. The idea is that when it updates in the future it will piece itself together again and the analysis will run without any additional effort (or risk of human error) on our part.

I followed the Google Support syntax, with one accomodation to fit the multiple sheets. This was mentioned on other posts and seems to work for other people--when combined with IMPORTRANGE referencing outside workbooks, though. There has to be a similar way to do it within the same workbook.

What I've tried:

=QUERY({'LandingPages-Oct1'!A16:F,'LandingPages-Oct2'!A16:F},"select *",0)

^ All comma separation causes the sheets to import side by side

=QUERY({'LandingPages-Oct1'!A16:F;'LandingPages-Oct2'!A16:F},"select *",0)

^ Semicolon separating sheets causes the first sheet of data to appear, but not the second

=QUERY({'LandingPages-Oct1'!A16:F;'LandingPages-Oct2'!A16:F};"select *",0)

^ Semicolon separating query parameters returns no results

What am I missing?

Sample data: https://docs.google.com/spreadsheets/d/1STuBdXPCY-mtJdmKZVblR8WlvLaRPa3tl4Kme10sQBQ/edit?usp=sharing