IMPORTRANGE Function in☝️ Google Sheets Explained (Definition, Syntax, How to Use It, Examples)

This guide covers everything you need to know about the Google Sheets IMPORTRANGE function, including its definition, syntax, use cases, and how to use it.

What is the IMPORTRANGE Function? How Does It Work?

The IMPORTRANGE function in Google Sheets lets you bring in data from one Google Sheet to another. Think of it like copying and pasting data between sheets, but done automatically. It’s handy when you have a lot of data or are using multiple sheets and want to see data from one sheet in another.

When using the IMPORTRANGE function, two primary elements come into play: the spreadsheet_url and the range_string. The spreadsheet_url is the direct link to the spreadsheet where the required data is located while the range_string specifies the exact range of cells you wish to import into your current sheet.

The IMPORTRANGE function in Google Sheets is special because it updates data in real-time. If you change something in the original sheet, the sheet you’re bringing the data into will update automatically. You’ll see a green loading bar when it’s updating. But remember, if the original sheet is busy calculating something, IMPORTRANGE will wait until that’s done before updating the other sheet.

The IMPORTRANGE function in Google Sheets is great for using data from different sheets together. However, be careful how you use it to avoid problems. It’s a good idea to organize and shorten your data first, especially if the original sheet gets updated a lot.

Equally important is the avoidance of IMPORTRANGE cycles. These occur when multiple spreadsheets reference each other in a looping pattern through the IMPORTRANGE function, which can lead to continuous attempts at referencing without ever producing a data output.

Finally, it’s worth noting that the IMPORTRANGE function reloads when a document is first opened or has been opened within the past 5 minutes, requiring it to “wake up” all documents it imports from. By understanding these technical details and adhering to best practices, the IMPORTRANGE function can be a highly effective feature for managing and manipulating data across multiple Google Sheets.

IMPORTRANGE Syntax

The syntax and arguments for the function are as follows:

Syntax:

IMPORTRANGE(spreadsheet_url, range_string)

Where:

  • spreadsheet_url is the URL of the spreadsheet from which data will be imported. It is a required argument.
  • range_string is a string specifying the range to import. It is also a required argument. The format for this string is “[sheet_name!]range”. For example, “Sheet1!A2:B6” or “A2:B6”.

Here are some important usage notes related to the syntax and arguments:

  • When you change the original sheet, any sheet that uses its data will refresh.
    IMPORTRANGE waits for the original sheet to finish its work before updating other sheets.
    Keep the number of sheets that pull data from the original low because they all need to read from it.
    Make sure to tidy up and shorten your data before using IMPORTRANGE, especially if the original sheet changes often.
    Be careful with chains: if Sheet A updates Sheet B, and then Sheet B updates Sheet C, any change to Sheet A will refresh both B and C.
    Don’t make sheets reference each other in circles. If Sheet A uses data from Sheet B, and Sheet B also uses data from Sheet A, they’ll keep trying to update each other, and nothing will get done.
    Sometimes there’s a wait time from when you change the original sheet to when the other sheet updates.
    If a sheet is new or hasn’t been opened for 5 minutes, IMPORTRANGE has to “wake up” any sheets it gets data from.

Example of How to Use the IMPORTRANGE Function

Here is a practical examples of how to use the IMPORTRANGE function in Google Sheets:

Imagine you’re a teacher and you have a Google Sheet titled “Student Scores” where you record the marks of all your students for each assignment. As the end of the term approaches, you decide to create another sheet titled “Term Summary” to track average scores and other statistics.

To get the average score of an assignment from “Student Scores” into “Term Summary” without manually copying the data, you can use the IMPORTRANGE function. First, open the “Student Scores” sheet and copy its URL from the browser’s address bar. Then, head to your “Term Summary” sheet and click on the cell where you want the average score to appear. Enter the formula =IMPORTRANGE(“URL_of_Student_Scores”, “Sheet1!B2:B30”), replacing URL_of_Student_Scores with the actual URL you copied. This formula pulls data from cells B2 to B30 of the “Student Scores” sheet.

Upon entering the formula, Google Sheets might ask for permission to connect the two sheets. Click on Allow access. Now, the selected range of scores will appear in your “Term Summary” sheet, and they will update automatically if changes are made in the original “Student Scores” sheet.

IMPORTRANGE: Common Mistakes & Problems

When using IMPORTRANGE in Google Sheets, users often encounter several common mistakes and problems. Understanding these issues can help you troubleshoot and resolve any difficulties you might face:

  • Incorrect Spreadsheet URL: The most common mistake is using an incorrect URL for the source spreadsheet. The URL should be the complete web address of the source spreadsheet and not just the name or part of the URL.
  • Missing ‘Sheet’ Name: Another common mistake is not specifying the name of the sheet from the source spreadsheet. If the name of the sheet is not included, Google Sheets will import data from the first sheet by default.
  • Incorrect Cell Range: The cell range specified in the IMPORTRANGE function must be accurate. The function will return an error if the cell range does not exist in the source spreadsheet.
  • Insufficient Access Rights: The IMPORTRANGE function will not work if you do not have access rights to the source spreadsheet. Make sure you have at least view rights to the source spreadsheet.
  • Unapproved Access: The first time you use the IMPORTRANGE function, Google Sheets prompts you to allow access to the source spreadsheet. If you dismiss this prompt without granting access, the function will not work.
  • Exceeding Cell Limit: Google Sheets has a limit of 5 million cells per workbook. If your import range exceeds this limit, the function will not work.
  • Syntax Errors: Ensure that all arguments of the IMPORTRANGE function are correctly formatted. This includes correct use of quotation marks and commas.

Why Is IMPORTRANGE Not Working? Troubleshooting Common Errors

If you are trying to use the IMPORTRANGE function in Google Sheets and it’s not working, it can be due to several reasons. Some of the common errors, their causes, and solutions are as follows:

#N/A Error

Cause: This error usually appears when the data you are trying to import with IMPORTRANGE does not exist or has been deleted.

Solution: Check the source spreadsheet and ensure the data you are trying to import still exists. If not, update the data in the source spreadsheet or adjust your IMPORTRANGE function to target the correct range.

#REF! Error

Cause: The #REF! error typically occurs when the IMPORTRANGE function is not granted permission to access the data from the source spreadsheet.

Solution: Click on the cell with the #REF! error to see a prompt asking for access. Click ‘Allow access’ to grant permission. If the error persists, check the URL of the source spreadsheet in the IMPORTRANGE function to ensure it is correct.

#ERROR! Error

Cause: This error may occur if the syntax of the IMPORTRANGE function is not correct.

Solution: Ensure that the syntax of your IMPORTRANGE function is correct. It should be IMPORTRANGE(“spreadsheet_url”, “range_string”) with the spreadsheet_url being the URL of the source spreadsheet and range_string being the range of cells you want to import.

Loading Error

Cause: If your IMPORTRANGE function shows “Loading…” but never loads the data, it can be due to a large amount of imported data.

Solution: If you are trying to import a large amount of data, consider breaking it down into smaller ranges. This can be achieved by using multiple IMPORTRANGE functions for different data ranges in the source spreadsheet.

Using IMPORTRANGE With Other Google Sheets Functions

Combining IMPORTRANGE with other Google Sheets functions can unlock a new level of data manipulation and analysis. This can be particularly useful when you want to import data from another Google Sheets document and then perform operations on that data. Here are a few examples of how you can use IMPORTRANGE in conjunction with other functions.

With QUERY

Usage: The QUERY function can be used with IMPORTRANGE to filter or sort the imported data based on certain conditions.

Example: Suppose you have a Google Sheets document with sales data and want to import only the data for a specific product. You can use the QUERY function with IMPORTRANGE like this:

=QUERY(IMPORTRANGE(“SpreadsheetURL”, “Sheet1!A1:C100”), “SELECT Col1, Col2, Col3 WHERE Col2 = ‘ProductA'”)

This formula imports data from cells A1 to C100 from the specified spreadsheet and then selects only the rows where the value in the second column is ‘ProductA’.

With SUM

Usage: The SUM function can be used with IMPORTRANGE to calculate the sum of a range of cells from another Google Sheets document.

Example: Suppose you want to calculate the total sales from another Google Sheets document. You could use the SUM function with IMPORTRANGE like this:

=SUM(IMPORTRANGE(“SpreadsheetURL”, “Sheet1!B2:B100”))

This formula imports data from cells B2 to B100 from the specified spreadsheet and then calculates the sum of these values.

With AVERAGE

Usage: The AVERAGE function can be used with IMPORTRANGE to calculate the average of a range of cells from another Google Sheets document.

Example: Suppose you want to calculate the average sales from another Google Sheets document. You could use the AVERAGE function with IMPORTRANGE like this:

=AVERAGE(IMPORTRANGE(“SpreadsheetURL”, “Sheet1!B2:B100”))

This formula imports data from cells B2 to B100 from the specified spreadsheet and then calculates the average of these values.

For more details on the IMPORTRANGE function, check out the official documentation at the Google Docs Editors Help Center.

More Google Sheets Tutorials
More Microsoft Excel Tutorials
Share This Post
Daniel Smith
Daniel Smith
Daniel Smith is automation consultant with a passion for technology, data, AI, and machine learning.