Prefer watching a video tutorial? View our IMPORTRANGE Google Sheets guide here:
Accessing data from one workbook to another in Google Sheets is not as simple as it would be for any other spreadsheet software. This is mainly due to the online nature of Google Sheets.
And it makes sense, keeping in mind data security issues.
But Google does allow you to access and use data from an external worksheet, as long as you have the right permission and access. It provides this facility through its IMPORTRANGE Google Sheets function.
If you’ve ever seen Google Sheets IMPORTRANGE function call before, you might have felt intimidated by the (seemingly) sheer length and complexity of it.
But to be honest, its syntax is way simpler than it seems. In this tutorial we will take a closer look at the IMPORTRANGE Google spreadsheet function and understand how it works, using a simple example.
Why Use IMPORTRANGE in Google Sheets
- You can import data quickly and easily
- You can import exact ranges
- You can place it in any cell in your spreadsheet
- Real-time data transfers
Syntax of the IMPORTRANGE Google Sheets Function
The syntax of the IMPORTRANGE function is:
The function takes two parameters:
- spreadsheet_url : This is the URL of the source spreadsheet.
- range_string: This is a string containing information about the range of cells to import.
Let us understand these parameters in a little more detail.
Spreadsheet URL or Workbook key
This is the first parameter of the IMPORTRANGE function. It contains the Spreadsheet URL or Google key of the Workbook that you want to import from.
Below is where you can find the Google Sheets URL
And you can also use the workbook key instead of using the entire URL in the IMPORTRANGE function.
This parameter is usually a string value. It can either contain the URL of the source sheet (enclosed in double-quotes), or a reference to a cell containing the URL of the source spreadsheet (without double quotes).
The spreadsheet URL is the entire location that you see on your browser’s location bar when your source spreadsheet is open.
Here’s an example:
The first part of the URL is the main Google Sheets URL. This is followed by the “d” folder, followed by a really large string of alphanumeric characters. This is the Workbook key, or the ID that Google spreadsheets use to identify the workbook.
To specify the first parameter of the IMPORTRANGE function, you can either use the full URL of the spreadsheet or just the spreadsheet key. Either one is enough to identify the spreadsheet that you want to import from.
Related Reading: How to Import XML Files into Google Sheets
The Range String is the second parameter of theImport Range formula. This is also a string value, and has the following format:
As you can see, the range_string contains two parts:
- sheet_name: This is the name of the spreadsheet you want to import data from.
- range: This is the range of cells that you want to import from the source sheet. This component can either be a reference to a range of cells, a single cell, or a named range.
Note that the sheet_name component has been represented in square brackets because this part of range_string is optional. If you don’t provide this component, IMPORTRANGE will, by default, import the first sheet of the specified workbook.
Here’s are some examples of range strings:
- “MySheet!A1:B10” : A range_string like this is used when you want to import cells A1 to B10 from the worksheet named “MySheet”.
- “A1:B10”: A range_string like this is used when you want to import cells A1 to B10 from the first sheet in the source workbook.
- “MySheet!A5”: A range_string like this is used when you want to import just one cell, A5 from the worksheet named “MySheet”.
Now let’s take a look at some IMPORTRANGE function Google Sheets examples.
Example 1: How to Use IMPORTRANGE in Google Sheets With a Spreadsheet URL or Spreadsheet Key
To demonstrate how to use the IMPORTRANGE function, let’s try to import the cells A1 to B7 from a sheet named “Employees”, belonging to an external workbook.
Here are the steps that you need to follow:
- Open the workbook containing the source spreadsheet (‘Employee Details 2020’ in our example).
- In the location bar of your browser, you can see the URL of the workbook. You can either select the entire URL (as shown in image 1) or select just the workbook key (as shown in image 2).
- Copy the selected URL or workbook key by pressing CTRL+C in the keyboard.
- Next, open your target workbook.
- Click on the cell where you want the range of imported cells to start displaying. In our example, we want to start displaying the cells from A1 onwards.
- Type the formula: =IMPORTRANGE(“<<url_here>>”,”<<source_sheet_name_here>>!<<range_here>>”).Replace <<url_here>>, <<source_sheet_name_here>> and <<range_here>> with the appropriate values. In our case, we will enter =IMPORTRANGE(“1Hw9qK3r4egNP7EHsYH2kcpBOAdGn64iW-WEIZ59rtF4″,”Employees!A1:B7”)
- Press the return key.
- Give it some time to process.
- When using the IMPORTRANGE function for the first time, you will get a #REF, as shown below:
- When you hover over the cell, you will get a prompt asking you if you want to allow access to the sheet.
- Click on the button that says “Allow Access”.
- You should now see your range of cells from the source sheet displayed at your desired point in the target sheet.
Note: You will get the #REF error (from step 9) only the first time that you import from the source sheet. The next time you use this function, it will not display this error or ask for permission again. This access remains in effect until the user who granted access is removed from the source.
It’s also important to make sure that there are enough empty cells in the target sheet to accommodate the result of the formula.
In this way, the IMPORTRANGE function can be used to access data from other workbooks. This becomes especially helpful when you want to pull together data from multiple workbooks into a single sheet.
For example, you could import employee details of different company branches into one cumulative sheet with the help of IMPORTRANGE.
We hope we have been successful in helping you understand what the IMPORTRANGE Google Sheets function does and how to use it. We encourage you to try it out for yourself and see how convenient and time-saving it can be.
Example 2: How to Do IMPORTRANGE in Google Sheets With a Named Range
You can also use the import range Google Sheets function with named ranges, to do so:
- Name the range in the source sheet
- Use the name you set as the range_string of the IMPORTRANGE formula
For example, if you named the range “NamedRange1” your formula may look something like this:
Why Is IMPORTRANGE Not Working? (Common Issues and How to Fix)
Unfortunately, there is no one size fits all solution to an IMPORTRANGE internal error, but never fear, follow our list for potential causes and fixes for this issue.
- Don’t call the same data more than once. Use the IMPORTRANGE function in a dedicated tab and copy it over to others as needed
- Check for empty rows in the source sheet. If the source sheet has tens of thousands of empty rows it will cause errors, so delete them first
- Temporarily turn of Iterative Calculations on both sheets
- Check for volatile functions that auto-update like TODAY(), NOW(), and RAND() and temporarily disable them.
- Make sure you are using a stable internet connection
How to IMPORTRANGE in Google Sheets FAQ
How Do I Use IMPORTRANGE in Google Sheets With Conditions?
Is IMPORTRANGE Dynamic? / Does IMPORTRANGE Automatically Update?
Yes IMPORTRANGE in dynamic, any changes you make to the source sheet will show up in the imported data.
What Is the Difference Between IMPORTRANGE and IMPORTDATA?
Is There a Limit on IMPORTRANGE in Google Sheets?
Yes, there is a limit on IMPORTRANGE, there can only be a maximum of 50 cross-workbook reference formulas.
Keep Importing Data
Using IMPORTRANGE in Google Sheets isn’t the only way to import data. There are also plenty of ways to perform queries. If you found this IMPORTRANGE Google Sheets guide useful, here or some otherther Google Sheets tutorials you may like:
- How to Use the FILTER Function in Google Sheets (Examples)
- IFS Function in Google Sheets – Test Multiple Conditions (Examples)
- How to Show Formulas in Google Sheets (instead of the value)
- How to Sum a Column in Google Sheets
- INDIRECT function in Google Sheets
- REGEXMATCH Function in Google Sheets
- How to Scrape Websites Using Google Sheets Formulas (Examples)