What IMPORTRANGE does
IMPORTRANGE copies the values from a range in one spreadsheet into another, and the copy updates over time. The syntax is:
=IMPORTRANGE(spreadsheet_url, range_string)
Both arguments go in double quotes. The spreadsheet_url is the link to the other file. The range_string names the sheet and the cells, such as “Sales!A1:D100”. For example:
=IMPORTRANGE("https://docs.google.com/spreadsheets/d/1bQ9xK2mRt7vLpW4sYz8dNcH3eFgJa5uTo6iVkOqBrE", "Sales!A1:D100")
To use your own file, copy its link from the browser’s address bar and paste it into the first set of quotes.
The first-time connection
The first time you import from a file, the cell shows #REF! with a prompt to connect the sheets. Click Allow access, and the import starts. You may see the prompt again for each new source file.
Sharing rules
The source file must be shared with the person who creates the formula, with at least view access. If it isn’t, the import won’t work, and the file’s owner needs to share it.
Refresh timing
IMPORTRANGE updates on its own, but not instantly. Changes in the source can take a little while to appear in the destination. If the numbers look out of date, wait a short time and check again before you assume the formula is broken.
Import only what you need
Import a specific range, such as Sales!A1:D100, rather than a whole sheet. A smaller import is quicker to check, and it’s less likely to pull in rows you didn’t mean to include.
Combining IMPORTRANGE with QUERY
To pull only some rows from the other file, put IMPORTRANGE in one cell, such as A1. The imported block fills the cells below and to the right of A1, up to the size of the range. Then run QUERY on that block from another cell, such as F1:
=QUERY(A1:D100, “select A, B, D where D > 500”, 1)
This keeps the long import formula in one place. If the source range grows past row 100, widen the QUERY range to match. The query function google sheets examples show more ways to write the query.
Overwrite errors
The import fills the cells it needs, the same way a spilled formula does. If you type something into one of those cells, or the cells hold older data, the import can’t fill its range and shows an error. Clear the cells the import needs, or move the formula so it has room.
Common problems
- A wrong link or a misspelled sheet name gives an error. Check both parts of the formula.
- Someone without access to the source sees an error, even if you can see the data. The owner needs to share the file with them.
- If the source file is deleted, or its owner removes access, the import stops updating.
Google Sheets only
IMPORTRANGE is specific to Google Sheets. In Excel, the nearest equivalent is a link to another workbook, which is stored in the file itself and can break when the files are moved or renamed.