Google Sheets' QUERY function cannot read every tab in a spreadsheet on its own — there is no built-in "all sheets" keyword. To query all sheets you first combine the data into one range, either by stacking each tab with curly-brace array syntax or by consolidating tabs into a single helper sheet, then run QUERY against that combined range. The steps below cover both methods and the errors you are most likely to hit.

What You'll Need

  • A Google account with edit access to the spreadsheet.
  • At least two tabs (sheets) whose columns are laid out in the same order and data types.
  • One empty tab to hold the combined data or the query result.
  • Familiarity with the QUERY syntax: =QUERY(range, "select * where Col1 is not null", 1).

Step-by-Step

  1. Open your spreadsheet and confirm every tab you want to include has the same column structure: same number of columns, same order, and consistent data types (no dates in a text column, for example). QUERY reads columns by position, not by header name.
  2. Create a new tab and name it something like Combined. This is where the merged range or the query result will live.
  3. If you want a live combined range, click the first cell of the Combined tab and enter an array literal that stacks each sheet vertically. The pattern is ={Sheet1!A2:D; Sheet2!A2:D; Sheet3!A2:D}. Replace the sheet names and ranges with your own. The semicolon stacks rows; a comma would place ranges side by side.
  4. Wrap that same array in QUERY to filter or sort the combined data. For example: =QUERY({Sheet1!A2:D; Sheet2!A2:D; Sheet3!A2:D}, "select * where Col1 is not null order by Col1", 0). Use 0 as the header argument because the array literal has no header row of its own.
  5. If your sheet names contain spaces or punctuation, wrap them in single quotes inside the formula: ={'Q1 Sales'!A2:D; 'Q2 Sales'!A2:D}.
  6. Press Enter and check the output. If you see #REF! or #VALUE!, the ranges likely have mismatched column counts — go back and align them.
  7. For a static snapshot instead, copy the data from each tab and paste it into the Combined tab one below the other, then run =QUERY(Combined!A1:D, "select * where Col1 is not null", 1) from a separate results tab. This is simpler but does not update automatically.
  8. To add a new tab later, edit the array literal and insert another ; 'NewSheet'!A2:D segment before the closing brace. Array literals do not pick up new tabs automatically.
  9. Freeze the header row of your results tab and format the output as needed. QUERY returns values, not formatting, so number formats and colours must be applied to the results range.

Common Mistakes

  • Mismatched column counts. Stacking a 4-column range with a 3-column range returns an error. Every segment in the array literal must have the same width.
  • Including header rows in each segment. Start each range at row 2 (for example A2:D) so headers are not duplicated in the output.
  • Using A1 notation in the query string. QUERY uses Col1, Col2 and so on, not A, B, C. Referring to A inside the query text fails.
  • Forgetting the header argument. The third parameter tells QUERY how many header rows the source has. With an array literal it should be 0; with a normal range it is usually 1.
  • Unquoted sheet names with spaces. Sheet names containing spaces must be wrapped in single quotes inside the formula.
  • Expecting automatic tab discovery. No formula scans a workbook for new tabs. Every tab must be named explicitly in the array or consolidated manually.

Tips

  • Keep a consistent tab-naming convention (for example Data_Jan, Data_Feb) so array literals are quick to edit and audit.
  • Use IMPORTRANGE only when the data lives in a different spreadsheet; within one file, direct sheet references are faster and simpler.
  • Test the array literal without QUERY first. If the stacked range displays correctly, adding QUERY is a small extra step.
  • If the combined range grows large, QUERY can slow the sheet down. Limit the columns you select rather than pulling every column.
  • Labels can differ slightly between Google Sheets versions and regions, but the QUERY syntax itself is stable across desktop and mobile; complex array formulas are easiest to write on desktop.

Troubleshooting

  • #REF! error: Usually a mismatched range size or an invalid sheet reference. Check that every segment has the same number of columns and that sheet names are spelled exactly.
  • #VALUE! error: Often caused by mixed data types in a column — for example text in a column of numbers. Clean the source data or cast values consistently.
  • #N/A error: The query references a column that does not exist in the range. Count your columns and adjust Col references.
  • Empty results: The where clause may be filtering out everything. Remove the clause temporarily to see the raw combined data.
  • Formula shows as text: The cell may be formatted as plain text. Clear the format or retype the formula starting with =.
  • Results do not update: If you used the copy-and-paste method, the Combined tab is static. Switch to the array-literal method for live updates.

Frequently Asked Questions

Can QUERY pull from every tab automatically?

No. QUERY works on a single range. You must combine tabs into one range using an array literal or a helper sheet first.

Does the array literal update when I add a new tab?

No. You have to edit the formula and add the new sheet reference manually.

Can I query tabs with different column orders?

Not directly. Reorder the columns in the source tabs or use separate queries and combine the results.

Why does my query return the header row twice?

Your array segments probably include row 1. Start each segment at row 2 and set the header argument to 0.

Can I use QUERY across multiple spreadsheet files?

Only by first importing the other file's data with IMPORTRANGE into a tab, then querying that tab.

Does QUERY work the same on the mobile app?

The function behaves the same, but writing long array formulas is much easier on desktop.