0Pricing
Excel Formulas Academy · Lesson

Pulling Data With IMPORTRANGE

Reference data from another Google Sheets file.

Pulling Data With IMPORTRANGE is a free Excel Formulas Academy lesson on CoddyKit — lesson 4 of 4. You can read the complete lesson below for free — then practise it hands-on in the browser with a built-in code editor and a 24/7 AI tutor. It is part of the Excel Formulas Academy learning path, one of 4 lessons in the course, and your progress syncs across the web and the CoddyKit app.

Linking Spreadsheets

Sometimes the data you need lives in a different Google Sheets file: a master list someone else maintains, or last month's report. IMPORTRANGE pulls that data into your current sheet, live.

When the source updates, your sheet updates too. It is the backbone of multi-file dashboards in Google Sheets, and like QUERY it is Sheets-only.

The Two Arguments

IMPORTRANGE needs two things:

  • spreadsheet_url the link or key of the source file, in quotes
  • range_string the sheet and range to pull, like 'Sheet1'!A1:D10, also in quotes

Both arguments are text strings, so both go in double quotes.

=IMPORTRANGE("https://docs.google.com/spreadsheets/d/ABC123", "Sheet1!A1:D10")

Using the Spreadsheet Key

Instead of the full URL you can use just the key, the long ID in the middle of the link. Both work identically.

The key is the part between /d/ and the next slash in a Sheets URL. Using the key keeps formulas shorter and tidier.

=IMPORTRANGE("1aBcDeFgHiJkLmNoPqRsTuVwXyZ", "Sales!A1:D100")

The Permission Step

The first time you reference a new file, IMPORTRANGE shows a #REF! error with the message You need to connect these sheets.

Hover the cell and click Allow access. This one-time grant links the two files. After approving, the data flows in. This is a security feature, not a bug.

It Spills Into a Range

IMPORTRANGE returns an array, so it spills across multiple cells starting where you put it. Place it in an empty area with room to expand.

If cells below or to the right are occupied, you will get a spill or #REF! error. Give it space, like a fresh corner of a tab.

=IMPORTRANGE("1aBcDeFgHiJkLmNoPqRsTuVwXyZ", "Orders!A:F")

Importing a Single Column

You do not have to import a whole table. Narrow the range string to bring in exactly what you need, such as one column.

This pulls only the names from column A of the source. Smaller imports keep your sheet fast and focused.

=IMPORTRANGE("1aBcDeFgHiJkLmNoPqRsTuVwXyZ", "People!A2:A")

Filtering Imported Data With QUERY

IMPORTRANGE pulls everything in the range, but you can wrap it in QUERY to filter at the same time. The imported array becomes QUERY's data argument.

Note that inside QUERY you reference imported columns as Col1, Col2, and so on, not by letter.

=QUERY(IMPORTRANGE("1aBcDeFgHiJkLmNoPqRsTuVwXyZ", "Sales!A1:D100"), "SELECT Col1, Col4 WHERE Col4 > 500", 1)

Col1 Instead of Letters

This is the key gotcha when combining the two functions. Because the data comes from a formula and not a real range, QUERY cannot see sheet letters.

So A becomes Col1, B becomes Col2, counting from the first imported column. Remember this and the combo works smoothly.

=QUERY(IMPORTRANGE("1aBcDeFgHiJkLmNoPqRsTuVwXyZ", "Sales!A1:D100"), "SELECT Col1, SUM(Col4) GROUP BY Col1", 1)

Refresh and Performance

Imported data refreshes automatically, roughly every hour or when the file is opened or edited. It is live but not instant to the second.

Many large IMPORTRANGE calls can slow a sheet. Import only the ranges you need, and consider one import feeding several formulas rather than many separate imports.

Common Errors

Watch for these:

  • #REF! with connect sheets means you still need to click Allow access
  • #REF! from a spill means the landing area is not empty
  • #ERROR! often means the range string has bad quotes or a wrong sheet name

Double-check the sheet name exactly matches the source tab.

=IMPORTRANGE("1aBcDeFgHiJkLmNoPqRsTuVwXyZ", "Sheet1!A1:D10")

A Practical Pattern

A common setup: one tab holds a single IMPORTRANGE that mirrors a source table. Other tabs and formulas then reference that local mirror, not the import directly.

This keeps permissions in one place, speeds things up, and makes your formulas reference simple ranges like Import!A:D instead of long URLs.

=IMPORTRANGE("1aBcDeFgHiJkLmNoPqRsTuVwXyZ", "MasterData!A1:F500")

Quick Check

Check your IMPORTRANGE understanding.

Recap

You can now pull data across files:

  • IMPORTRANGE(url_or_key, range_string) imports live data
  • The first use needs a one-time Allow access click
  • Results spill, so give them empty space
  • Wrap in QUERY to filter, using Col1, Col2 names
  • Import only what you need and mirror it once for speed

That completes the Google Sheets QUERY and ARRAYFORMULA toolkit.

=QUERY(IMPORTRANGE("1aBcDeFgHiJkLmNoPqRsTuVwXyZ", "Sales!A1:D100"), "SELECT Col1, SUM(Col4) GROUP BY Col1 ORDER BY SUM(Col4) DESC", 1)

Frequently asked questions

Is the “Pulling Data With IMPORTRANGE” lesson free?

Yes — the full text of “Pulling Data With IMPORTRANGE” is free to read here on the web, and the Excel Formulas Academy course includes 4 lessons in total. To practise it interactively (a built-in code editor and a 24/7 AI tutor) and unlock the rest of the Excel Formulas Academy course, upgrade to CoddyKit PRO.

What will I learn in “Pulling Data With IMPORTRANGE”?

Reference data from another Google Sheets file. You practise Excel Formulas Academy with hands-on code you run directly in the browser, and a 24/7 AI tutor answers your questions as you work through the lesson.

Do I need any experience to start Excel Formulas Academy?

No prior experience is required. Excel Formulas Academy on CoddyKit is structured for beginners through advanced learners; this is — lesson 4 of 4, so you can start here or from the beginning and move at your own pace.

How long does the “Pulling Data With IMPORTRANGE” lesson take?

Most CoddyKit lessons take about 5–10 minutes. Each one is bite-sized and interactive, so you make steady progress and pick up exactly where you left off across the web and the app.

Can I write and run code in this Excel Formulas Academy lesson?

Yes. Every Excel Formulas Academy lesson includes a built-in code editor, so you write and run real code right in your browser and get instant AI feedback — no local setup required.

All lessons in this course

  1. Querying Data With QUERY
  2. Sorting and Grouping in QUERY
  3. Applying Formulas to Columns With ARRAYFORMULA
  4. Pulling Data With IMPORTRANGE
← Back to Excel Formulas Academy