We’re improving Formula Genius. We’re redesigning the app and fixing issues along the way. Sorry for any disruption, and thank you for your patience.
Google Sheets advanced

IMPORTRANGE + QUERY: Cross-Spreadsheet Data Pulls

Pull specific data from another Google Sheets file and filter it — all in one formula. The most powerful cross-sheet technique.

Formula Genius can generate a draft from a plain-English prompt. Supported formulas can be checked with sample cases; review the coverage on the result.

The formula

Prompt

"Import only Q1 2026 sales data from another spreadsheet"

Google Sheets
=QUERY(IMPORTRANGE("spreadsheet_url","Sheet1!A1:D100"),"SELECT * WHERE Col3 >= date '2026-01-01' AND Col3 < date '2026-04-01'")

IMPORTRANGE pulls the raw data from the external spreadsheet, then QUERY filters it to only Q1 2026 rows before displaying results.

Step-by-step breakdown

  1. IMPORTRANGE(url, range) fetches data from the other spreadsheet
  2. The URL must be the full Google Sheets URL or just the spreadsheet ID
  3. QUERY wraps the imported data to filter before displaying
  4. In QUERY over IMPORTRANGE, columns are referenced as Col1, Col2, etc. (not A, B, C)
  5. First-time use requires clicking Allow Access in the target cell

Edge cases & warnings

  • First use requires manual permission grant (click the cell, click Allow)
  • IMPORTRANGE is slow — avoid pulling more data than needed
  • Column references change to Col1, Col2 format inside QUERY when source is IMPORTRANGE
  • Rate limits: Google limits IMPORTRANGE calls per spreadsheet

Examples

Prompt

"External spreadsheet with full-year sales data"

Google Sheets
Only Q1 2026 rows imported and displayed
Prompt

"Multiple sheets to consolidate"

Google Sheets
Use separate IMPORTRANGE+QUERY per source, stack with {range1;range2}

Frequently asked questions

Why does IMPORTRANGE show #REF?

You need to grant access. Click the cell with the error, and you'll see an Allow Access button. Click it once per source spreadsheet.

Can I use IMPORTRANGE in Excel?

No. IMPORTRANGE is Google Sheets only. In Excel, use Power Query to connect to external data sources.

Can't find what you need?

Describe a formula in plain English. Formula Genius drafts and explains it, and can check supported formulas on sample cases.