Google Sheets IMPORTRANGE Function: Syntax and Examples

By Dr. Zubair Khalid, DVM, MS, PhD ·

Google Sheets IMPORTRANGE Function: Syntax and Examples

The Google Sheets IMPORTRANGE function pulls a range of cells from one spreadsheet into another. You give it the source spreadsheet URL and a range string, and the data appears in your destination sheet. The most common problem is the #REF! error that appears before you grant access to the source file.

Quick Answer

  • Syntax: IMPORTRANGE(spreadsheet_url, range_string) [1]
  • spreadsheet_url is the full URL of the source spreadsheet, in quotation marks or in a cell reference [1]
  • range_string uses the format "[sheet_name!]range", for example "Sheet1!A2:B6" or "A2:B6" [1]
  • The first time you connect two files, you must click "Allow access" to authorize the connection
  • Results update automatically when the source data changes, but chained imports across many sheets can slow things down [1]

Syntax

IMPORTRANGE(spreadsheet_url, range_string) [1]

ArgumentRequired?Meaning
spreadsheet_urlYesThe URL of the spreadsheet you are importing from. Enclose it in quotation marks or point to a cell that contains the URL. [1]
range_stringYesA string in the format "[sheet_name!]range", such as "Sheet1!A2:B6" or "A2:B6". [1]

The function returns a spilled array of values. You enter it in one cell and the results fill the cells below and to the right.

How It Works

IMPORTRANGE reads the source spreadsheet on Google's servers and writes the requested values into your destination sheet. The destination sheet does not store a copy you can edit. It shows a live view of the source range.

The spreadsheet_url argument accepts the full URL from your browser's address bar. You can paste it directly into the formula inside quotation marks, or put it in a cell and reference that cell. Referencing a cell is easier to maintain when you reuse the same source across many formulas.

The range_string argument tells Sheets which cells to read. You can name the sheet, as in "Sheet1!A2:B6", or omit the sheet name to read from the first sheet, as in "A2:B6" [1]. You can also use a named range, such as "Sales_total", or a table reference, such as "DeptSales[Sales Amount]" [1].

When the source data changes, the imported values refresh. If you chain imports, where sheet B imports from sheet A and sheet C imports from sheet B, an update to sheet A causes both B and C to reload [1]. Google recommends limiting these chains [1].

Worked Example

Suppose you keep a monthly sales total in a source spreadsheet and want that single number in a summary dashboard. The source sheet has a value of 5 in cell B2 and a value of 3 in cell B3.

In the destination spreadsheet, you enter:

=IMPORTRANGE("https://docs.google.com/spreadsheets/d/abcd123abcd123", "Sheet1!B2:B3")

The first time you run it, the cell shows #REF!. Click the cell, then click "Allow access" in the prompt. The formula then returns 5 in the first cell and 3 in the cell below.

If you want the sum instead of the two separate values, you can wrap the import in a sum:

=SUM(IMPORTRANGE("https://docs.google.com/spreadsheets/d/abcd123abcd123", "Sheet1!B2:B3"))

This returns 8, because 5 + 3 = 8. Google notes that aggregating on the source side is faster than importing many rows and calculating in the destination. For a large dataset, calculate the sum in the source spreadsheet and import that single number [1].

More Examples

Import a block of cells from a named sheet. This pulls columns A through C, rows 1 to 10, from a sheet called Sales:

=IMPORTRANGE("https://docs.google.com/spreadsheets/d/abcd123abcd123", "Sales!A1:C10")

Import from the first sheet without naming it. When the source has only one sheet, you can drop the sheet name:

=IMPORTRANGE("https://docs.google.com/spreadsheets/d/abcd123abcd123", "A1:C10")

Reference the URL from a cell. Put the source URL in cell A1 of your destination sheet, then reference it:

=IMPORTRANGE(A1, "Sales!A1:C10")

This keeps the URL in one place so you can update it without editing every formula.

Import a named range. If the source defines a named range called Sales_total, you can import it directly [1]:

=IMPORTRANGE("https://docs.google.com/spreadsheets/d/abcd123abcd123", "Sales_total")

Import a table column. If the source uses a table named DeptSales, you can reference a column by name [1]:

=IMPORTRANGE("https://docs.google.com/spreadsheets/d/abcd123abcd123", "DeptSales[Sales Amount]")

Combine IMPORTRANGE with other functions. Because the result is a normal range, you can feed it into aggregation and lookup functions. For example, you can total an imported column with the Excel SUM function approach, or test imported values with a logical test like the Google Sheets IF function. To pull a specific item from an imported list, pair it with a lookup such as the Excel MATCH function.

Errors and How to Fix Them

#REF! on first use. This is the access error. The destination spreadsheet has not been granted permission to read the source. Click the cell with the formula and click "Allow access" when the prompt appears. After you approve once, the connection works for that source file.

#REF! after it previously worked. The source file may have been deleted, moved, or had its sharing settings changed. Open the source URL to confirm it still exists and that you still have access. If the owner revoked your permission, ask them to share it again.

#ERROR! for a bad range string. The range_string argument must be a valid range. Check for a missing sheet name, a typo in the sheet name, or a range that does not exist. A range like "Sheet1!A1:C10" works, and so does an open-ended range like "Sheet1!A1:C", but a misspelled sheet name or malformed reference does not.

#REF! for a missing sheet or range. If the sheet name in the range string does not match any sheet in the source file, the import fails with an "Unable to parse range" message. Sheet names are case-sensitive in some contexts, so match the name exactly as it appears on the tab.

Empty results. If the source range is blank, IMPORTRANGE returns blank cells. This is not an error. Check the source to confirm the data is where you expect it.

Circular dependency. If two spreadsheets import from each other, Sheets cannot resolve the loop. Break the cycle by removing one direction of the import.

Common Mistakes

  • Forgetting to grant access. The #REF! error confuses new users because the formula looks correct. Fix it by clicking the cell and approving access once.
  • Pasting the URL without quotation marks. The URL must be in quotation marks or a cell reference [1]. Fix it by wrapping the URL in double quotes.
  • Using the wrong range format. The range string needs the "[sheet_name!]range" format [1]. Fix it by including the sheet name and a valid cell range.
  • Importing a huge range and calculating in the destination. This is slower than aggregating on the source side [1]. Fix it by calculating the summary in the source and importing the single result.
  • Chaining many imports across sheets. Long chains reload every sheet when the source changes [1]. Fix it by limiting chains and importing from the original source where possible.
  • Editing imported cells. Imported values are read-only. Fix it by editing the source spreadsheet instead.

Limitations

IMPORTRANGE cannot write data back to the source. It is a one-way read. If you need two-way sync, you need a different tool or an Apps Script solution.

Large imports and long chains of imports can slow down recalculation. Google recommends aggregating data before it crosses the import boundary and limiting chains across multiple sheets [1]. The function also depends on the source file staying shared with you. If access is revoked or the file is deleted, the import breaks.

Frequently Asked Questions

Why does IMPORTRANGE show #REF! the first time I use it?

The destination spreadsheet has not been authorized to read the source. Click the cell with the formula and click "Allow access" in the prompt. After you approve once, the formula returns data. If it still fails, confirm you have at least view access to the source file.

Can IMPORTRANGE pull data from a spreadsheet I do not own?

Yes, as long as the owner has shared it with you or made it accessible. You need permission to view the source. If you can open the source URL in your browser, IMPORTRANGE can usually read it after you grant access.

Does IMPORTRANGE update automatically?

Yes. The imported values refresh when the source data changes. If you chain imports across several sheets, an update to the first sheet triggers reloads down the chain [1]. Long chains can make recalculation slower.

Can I use IMPORTRANGE with a named range or table?

Yes. The range_string argument accepts a named range such as "Sales_total" or a table reference such as "DeptSales[Sales Amount]" [1]. This is useful when the source range may shift over time.

How do I import only part of a sheet?

Set the range_string to the exact cells you need, such as "Sheet1!A1:C10" [1]. You can also wrap the import in functions like SUM or a lookup to return a single value. For very large sources, calculate the result in the source file and import that one number [1].

References

  1. IMPORTRANGE - Google Docs Editors Help

Further Reading

Related Articles