Spreadsheet Practice

IMPORTRANGE in Google Sheets: pull data from another spreadsheet

IMPORTRANGE copies a range from another Google Sheets spreadsheet into the one you are working in, and keeps it up to date. You give it the other file's URL (or just its key) and the range as text. The first time two files are linked, someone has to click Allow access.

Syntax
=IMPORTRANGE(spreadsheet_url, range_string)
Returns
The values of the range, spilling down and to the right from the formula cell. Formatting does not come across, only values.
In Excel
Excel has no IMPORTRANGE. To pull data from another workbook, use an external reference such as ='[Sales.xlsx]Orders'!A1, or load it with Power Query (Data > Get Data) and refresh it.

Syntax

ArgumentRequired?What it is
spreadsheet_urlRequiredThe other spreadsheet's full URL, or just its key: the long ID between /d/ and /edit in the URL. Put it in double quotes, or point at a cell that holds it.
range_stringRequiredThe range to import, as text in double quotes, such as "Orders!A1:F13". Add the tab name and an exclamation mark; put single quotes around tab names with spaces, as in "'Q3 Orders'!A1:F". Without a tab name, IMPORTRANGE reads the first tab.

The source spreadsheets

The examples pull from these files. Each one is already connected.

Regional sales 2026tabs Orders, Q3 Orders

URLhttps://docs.google.com/spreadsheets/d/1nV7cR2kQ8wZpL4tY6bH9sJ3mX0dF5gAeTqUKo2Pz/edit

Show Orders (13 rows)
1OrderRepRegionProductUnitsRevenue
2S-1001Ana RuizEastWidget402080
3S-1002Raj PatelWestGadget252225
4S-1003Lee ChenEastGizmo121740
5S-1004Ana RuizNorthGadget302670
6S-1005Kim OrtizWestWidget552860
7S-1006Raj PatelEastWidget18936
8S-1007Lee ChenSouthGadget221958
9S-1008Kim OrtizEastGizmo91305
10S-1009Ana RuizWestWidget351820
11S-1010Mo DiazNorthGizmo142030
12S-1011Raj PatelSouthWidget201040
13S-1012Kim OrtizNorthGadget161424
Show Q3 Orders (6 rows)
1OrderRepRegionProductUnitsRevenue
2S-1013Mo DiazEastGizmo284060
3S-1014Ana RuizWestGadget191691
4S-1015Lee ChenNorthWidget442288
5S-1016Kim OrtizSouthGizmo111595
6S-1017Raj PatelWestWidget271404
Price listtab Prices

URLhttps://docs.google.com/spreadsheets/d/1Fp3XqL8rT2vN6yB0cK4wM9hZ5jD7sG1aEuRoVi8/edit

Show Prices (8 rows)
1SKUItemPrice
2TB-110Desk lamp39
3TB-220Monitor arm89
4TB-330Laptop stand54
5TB-440USB hub29
6TB-550Desk mat24
7TB-660Webcam72
8TB-770Cable tray18

The sample data

Every example below runs on this sheet. Results are calculated by our formula engine in Sheets mode.

AB
1Look up SKUTB-220
2Sales filehttps://docs.google.com/spreadsheets/d/1nV7cR2kQ8wZpL4tY6bH9sJ3mX0dF5gAeTqUKo2Pz/edit
3RegionWest

The syntax: a file and a range

IMPORTRANGE takes two pieces of text: which spreadsheet, and which range in it. For the spreadsheet, paste its full URL from the address bar. Both arguments go in double quotes.

You can also give just the key, the long ID between /d/ and /edit in the URL. It does the same thing and keeps the formula shorter. Or keep the URL in a cell and point at the cell, so several formulas share it.

=IMPORTRANGE("https://docs.google.com/spreadsheets/d/1nV7cR2kQ8wZpL4tY6bH9sJ3mX0dF5gAeTqUKo2Pz/edit","Orders!A1:F13")

OrderRepRegionProductUnitsRevenue
S-1001Ana RuizEastWidget402080
S-1002Raj PatelWestGadget252225
S-1003Lee ChenEastGizmo121740
S-1004Ana RuizNorthGadget302670
S-1005Kim OrtizWestWidget552860
S-1006Raj PatelEastWidget18936
+ 6 more rows
The whole Orders tab of the sales file, header row included, using the full URL

=IMPORTRANGE("1nV7cR2kQ8wZpL4tY6bH9sJ3mX0dF5gAeTqUKo2Pz","Orders!A1:C5")

OrderRepRegion
S-1001Ana RuizEast
S-1002Raj PatelWest
S-1003Lee ChenEast
S-1004Ana RuizNorth
Just the key works too: the first three columns of the first four orders

=IMPORTRANGE(B2,"Orders!B1:B5")

Rep
Ana Ruiz
Raj Patel
Lee Chen
Ana Ruiz
The URL lives in B2 of this sheet, so the formula points at it instead of repeating it

Tab names, and when to quote them

Put the tab name in front of the range with an exclamation mark: "Orders!A1:F13". If the name has a space or other punctuation, wrap it in single quotes inside the double quotes: "'Q3 Orders'!A1:F6".

Leave the tab name out and IMPORTRANGE reads the first tab in the file. That works until someone reorders the tabs, so naming the tab is safer.

=IMPORTRANGE("1nV7cR2kQ8wZpL4tY6bH9sJ3mX0dF5gAeTqUKo2Pz","'Q3 Orders'!A1:F6")

OrderRepRegionProductUnitsRevenue
S-1013Mo DiazEastGizmo284060
S-1014Ana RuizWestGadget191691
S-1015Lee ChenNorthWidget442288
S-1016Kim OrtizSouthGizmo111595
S-1017Raj PatelWestWidget271404
A tab name with a space needs single quotes around it

=IMPORTRANGE("1nV7cR2kQ8wZpL4tY6bH9sJ3mX0dF5gAeTqUKo2Pz","A1:D4")

OrderRepRegionProduct
S-1001Ana RuizEastWidget
S-1002Raj PatelWestGadget
S-1003Lee ChenEastGizmo
No tab name: the range comes from the first tab, here Orders

Ranges that keep growing

A range like A1:F13 stops at row 13, so new orders added below it never arrive. Leave the row number off the end, as in Orders!A1:F, and the import runs to the bottom of the tab. Whole columns such as Orders!A:C work the same way.

An open range also brings in the blank rows at the bottom of the tab, so it spills further than the data. When you feed it to QUERY, add where Col1 is not null to drop them.

=IMPORTRANGE("1nV7cR2kQ8wZpL4tY6bH9sJ3mX0dF5gAeTqUKo2Pz","Orders!A1:F")

OrderRepRegionProductUnitsRevenue
S-1001Ana RuizEastWidget402080
S-1002Raj PatelWestGadget252225
S-1003Lee ChenEastGizmo121740
S-1004Ana RuizNorthGadget302670
S-1005Kim OrtizWestWidget552860
S-1006Raj PatelEastWidget18936
+ 6 more rows
Every row of Orders, including any added later

=IMPORTRANGE("1nV7cR2kQ8wZpL4tY6bH9sJ3mX0dF5gAeTqUKo2Pz","Orders!B:C")

RepRegion
Ana RuizEast
Raj PatelWest
Lee ChenEast
Ana RuizNorth
Kim OrtizWest
Raj PatelEast
+ 6 more rows
Two whole columns: rep and region

Connecting the files: Allow access

The first time a spreadsheet imports from another one, the formula shows #REF!. Hover over the cell and you'll see "You need to connect these sheets" with an Allow access button. Click it and the data appears.

To connect them you need to be able to open the source file. You only connect each pair of files once: after that, any editor of your spreadsheet can import any range from the source, and anyone who can see your spreadsheet sees the imported values, even if they can't open the source. Share the destination file with that in mind.

In the practice sheets on this page you'll see the same #REF! and an Allow access button before the import fills in.

Combine several tabs or files

To stack imports on top of each other, put them in braces with a semicolon between them. They need the same number of columns. Leave the header row out of the second one so it appears only once.

A comma instead of a semicolon puts the imports side by side, which needs the same number of rows.

={IMPORTRANGE("1nV7cR2kQ8wZpL4tY6bH9sJ3mX0dF5gAeTqUKo2Pz","Orders!A1:F13");IMPORTRANGE("1nV7cR2kQ8wZpL4tY6bH9sJ3mX0dF5gAeTqUKo2Pz","'Q3 Orders'!A2:F6")}

OrderRepRegionProductUnitsRevenue
S-1001Ana RuizEastWidget402080
S-1002Raj PatelWestGadget252225
S-1003Lee ChenEastGizmo121740
S-1004Ana RuizNorthGadget302670
S-1005Kim OrtizWestWidget552860
S-1006Raj PatelEastWidget18936
+ 11 more rows
Orders and Q3 Orders in one list, with one header row on top

QUERY on imported data: Col1, Col2

IMPORTRANGE and QUERY are often used together: import the raw data, then pick, filter and total it in one formula. Because the imported data is an array, not a range in this sheet, QUERY refers to its columns by position: Col1, Col2 and so on, with a capital C. Column letters give #VALUE! here.

The text you compare against still goes in single quotes, and you can splice in a cell, as in "where Col3 = '"&B3&"'".

=QUERY(IMPORTRANGE("1nV7cR2kQ8wZpL4tY6bH9sJ3mX0dF5gAeTqUKo2Pz","Orders!A1:F13"),"select Col2, Col4, Col6 where Col3 = 'West'",1)

RepProductRevenue
Raj PatelGadget2225
Kim OrtizWidget2860
Ana RuizWidget1820
Rep, product and revenue for the West orders

=QUERY(IMPORTRANGE("1nV7cR2kQ8wZpL4tY6bH9sJ3mX0dF5gAeTqUKo2Pz","Orders!A1:F"),"select Col3, sum(Col6) where Col1 is not null group by Col3 order by sum(Col6) desc label sum(Col6) 'Revenue'",1)

RegionRevenue
West6905
North6124
East6061
South2998
Revenue by region from an open range; is not null drops the blank rows

=QUERY(IMPORTRANGE(B2,"Orders!A1:F13"),"select Col1, Col2, Col6 where Col3 = '"&B3&"' order by Col6 desc",1)

OrderRepRevenue
S-1005Kim Ortiz2860
S-1002Raj Patel2225
S-1009Ana Ruiz1820
The region comes from B3, so changing it changes the result

FILTER and SORT on an import

SORT works on an import directly. FILTER needs the data and a condition that are the same height, so import the condition column as well.

Each IMPORTRANGE is its own formula reading the other file. When you need the same data several times, it is often simpler to import it once into a tab of your own and point the other formulas at that.

=SORT(IMPORTRANGE("1nV7cR2kQ8wZpL4tY6bH9sJ3mX0dF5gAeTqUKo2Pz","Orders!A2:F13"),6,FALSE)

S-1005Kim OrtizWestWidget552860
S-1004Ana RuizNorthGadget302670
S-1002Raj PatelWestGadget252225
S-1001Ana RuizEastWidget402080
S-1010Mo DiazNorthGizmo142030
S-1007Lee ChenSouthGadget221958
+ 6 more rows
Every order, highest revenue first. The header row is left out so it isn't sorted into the data

=FILTER(IMPORTRANGE("1nV7cR2kQ8wZpL4tY6bH9sJ3mX0dF5gAeTqUKo2Pz","Orders!A2:B13"),IMPORTRANGE("1nV7cR2kQ8wZpL4tY6bH9sJ3mX0dF5gAeTqUKo2Pz","Orders!C2:C13")="East")

S-1001Ana Ruiz
S-1003Lee Chen
S-1006Raj Patel
S-1008Kim Ortiz
Order and rep for the East orders: the region column is imported to test against

Look up a value in another file

IMPORTRANGE can sit inside a lookup, so the table you search lives in a different spreadsheet. With VLOOKUP, import the whole table. With XLOOKUP, import the column to search and the column to return separately.

=VLOOKUP(B1,IMPORTRANGE("1Fp3XqL8rT2vN6yB0cK4wM9hZ5jD7sG1aEuRoVi8","Prices!A2:C8"),3,FALSE)

89
The price of the SKU in B1, from the price list file

=XLOOKUP(B1,IMPORTRANGE("1Fp3XqL8rT2vN6yB0cK4wM9hZ5jD7sG1aEuRoVi8","Prices!A2:A"),IMPORTRANGE("1Fp3XqL8rT2vN6yB0cK4wM9hZ5jD7sG1aEuRoVi8","Prices!B2:B"),"Not found")

Monitor arm
The item name for the same SKU, with a fallback if it's missing

Keep imports quick

Large imports and many IMPORTRANGE formulas can make a spreadsheet slow to load, and the cells show Loading… while they fetch. Import only the columns and rows you need rather than whole tabs, and import a table once instead of in many small pieces.

IMPORTRANGE brings values, not formatting. Currency signs, colors and number formats stay behind, and dates can arrive as plain numbers until you format the column as a date.

=IMPORTRANGE("1nV7cR2kQ8wZpL4tY6bH9sJ3mX0dF5gAeTqUKo2Pz","Orders!B1:C13")

RepRegion
Ana RuizEast
Raj PatelWest
Lee ChenEast
Ana RuizNorth
Kim OrtizWest
Raj PatelEast
+ 6 more rows
Two columns instead of the whole tab: less to fetch, and nothing you don't use

Try IMPORTRANGE live

The sample sheet with a formula in D1. Click it and change the arguments to see what happens.

Practice IMPORTRANGE

3 graded exercises. Each answer is checked in Sheets mode, then re-checked on changed data.

1. Bring in the staff list

In A1, use IMPORTRANGE to pull A1:D8 of the Staff tab from this spreadsheet: https://docs.google.com/spreadsheets/d/1qW4eR7tY0uI3oP6aS9dF2gH5jK8lZxCvBnM1QwE/edit. Connect the files when the sheet asks.
Team rosteranother spreadsheet · tab Staff

URLhttps://docs.google.com/spreadsheets/d/1qW4eR7tY0uI3oP6aS9dF2gH5jK8lZxCvBnM1QwE/edit

#REF! The first time a spreadsheet pulls from another one, Sheets asks you to connect them. Hover the error cell and click Allow access.

2. Totals from the budget file

The budget lives in another spreadsheet, key 1Zx8Cv5Bn2Mq7Wl4Ek1Rt9Yu6Io3PaS0dFgHjK, on a tab called FY26 Budget (department in A, budget in C, spent in D, rows 2 to 9). In B1, total the whole Budget column. In B3, look up how much the department in B2 has spent.
Department budgetanother spreadsheet · tab FY26 Budget

URLhttps://docs.google.com/spreadsheets/d/1Zx8Cv5Bn2Mq7Wl4Ek1Rt9Yu6Io3PaS0dFgHjK/edit

#REF! The first time a spreadsheet pulls from another one, Sheets asks you to connect them. Hover the error cell and click Allow access.

3. Hours by agent, from another file

Support tickets are logged in another spreadsheet, key 1Hk2Jl9Mn4Bv7Cx0Zq3Wr6Ty1Ui5Op8As2DfGh, tab Tickets, range A1:E11 (agent in the second column, status in the fourth, hours in the fifth). In A1, use QUERY on the import to total the hours of Closed tickets for each agent, most hours first. Keep the header row.
Support loganother spreadsheet · tab Tickets

URLhttps://docs.google.com/spreadsheets/d/1Hk2Jl9Mn4Bv7Cx0Zq3Wr6Ty1Ui5Op8As2DfGh/edit

#REF! The first time a spreadsheet pulls from another one, Sheets asks you to connect them. Hover the error cell and click Allow access.

The QUERY guide, for filtering and totaling what you import →

IMPORTRANGE cheat sheet

TaskFormulaNote
Import a range=IMPORTRANGE("https://docs.google.com/spreadsheets/d/KEY/edit","Orders!A1:F50")Both arguments are text in double quotes
Use just the key=IMPORTRANGE("KEY","Orders!A1:F50")The key is the ID between /d/ and /edit
Keep the URL in a cell=IMPORTRANGE(B1,"Orders!A1:F50")B1 holds the URL or key
Tab name with spaces=IMPORTRANGE("KEY","'Q3 Orders'!A1:F")Single quotes inside the double quotes
First tab=IMPORTRANGE("KEY","A1:F50")No tab name reads the first tab
Grow with the data=IMPORTRANGE("KEY","Orders!A1:F")No end row: runs to the bottom of the tab
Stack two imports={IMPORTRANGE("KEY","Orders!A1:F");IMPORTRANGE("KEY","Q3!A2:F")}Same number of columns; skip the second header
Query the import=QUERY(IMPORTRANGE("KEY","Orders!A1:F"),"select Col2, Col6 where Col6 > 1000",1)Col1, Col2… not letters
Total a column=SUM(IMPORTRANGE("KEY","Orders!F2:F"))Any function that takes a range takes an import
Look up in another file=XLOOKUP(A2,IMPORTRANGE("KEY","Prices!A2:A"),IMPORTRANGE("KEY","Prices!C2:C"))Import the search column and the result column

Common IMPORTRANGE errors

What you seeWhy, and how to fix it
#REF! "You need to connect these sheets"The two files aren't connected yet. Hover over the cell and click Allow access. It only has to be done once for each pair of files.
#REF! saying you don't have permissionYour account can't open the source file. Ask its owner to share it with you, at least as a viewer, then click Allow access.
#REF! even though the file is connectedUsually the range string. Check the tab name is spelled exactly as in the other file, that names with spaces have single quotes around them, and that the exclamation mark is there.
Formula parse errorBoth arguments are text, so each needs double quotes: =IMPORTRANGE("KEY","Orders!A1:F"). A missing quote, or a range typed without quotes, breaks the whole formula.
#VALUE! from QUERY around IMPORTRANGEQUERY can't use column letters on imported data. Use Col1, Col2 and so on, counting from the first imported column, with a capital C.
#REF! "Array result was not expanded"The import needs empty cells below and to the right of the formula. Clear whatever is in the way, or move the formula.
Numbers or dates look wrongIMPORTRANGE brings values without their formatting. Format the destination columns as currency, percent or date yourself.

Questions

Does IMPORTRANGE update when the other file changes?

Yes. Edits in the source show up in the import on their own, though it can take a short while. You don't need to reopen either file.

Can people see the imported data if they can't open the source file?

Yes. Once the files are connected, the imported values are part of your spreadsheet, so anyone who can view your spreadsheet sees them. Import only what everyone with access to it should see.

Can I import from an Excel file in Google Drive?

IMPORTRANGE reads Google Sheets files. Open the .xlsx in Sheets and save it as a Google Sheets file first, then import from that copy.

How do I import from several files at once?

Stack the imports in braces with semicolons, ={IMPORTRANGE("KEY1","Data!A1:D");IMPORTRANGE("KEY2","Data!A2:D")}, as long as they have the same number of columns. Each file has to be connected once.

Why does QUERY say #VALUE! when I use column letters?

Imported data isn't a range in your sheet, so it has no column letters. Refer to the columns as Col1, Col2, Col3 in the order they were imported.

IMPORTRANGE or copy and paste?

Copy and paste gives you a snapshot that goes stale. IMPORTRANGE stays linked, so a report built on it keeps up with the source without anyone pasting again.

Last reviewed October 2026. Every result on this page is calculated live by the Spreadsheet Practice formula engine in Sheets mode. Google Sheets is a trademark of Google LLC; this guide is independent.