# IMPORTRANGE in Google Sheets: syntax and examples

URL: https://goingstellar.ro/reference/sheets/importrange/

IMPORTRANGE brings a range of cells from another spreadsheet into this one and keeps it up to date. The first time you connect two files, Sheets asks you to allow access. Nest it inside QUERY, SUM or VLOOKUP to work on the imported data.

## Syntax

```
IMPORTRANGE(spreadsheet_url, range_string)
```

## Arguments

- `spreadsheet_url` (string, required: yes): The full URL of the source spreadsheet, or just its ID.
- `range_string` (string, required: yes): Tab and range as text, for example "Sheet1!A1:B4". Without a tab name it reads the first tab.

## Examples

```
=IMPORTRANGE("1l9m6VNhndPMXSx1F80hKNl4zeWRIBG8aj38weuYWP9A", "Sheet1!A1:B4")
```

Result: 

| City | Orders |
|---|---|
| Cluj | 42 |
| Iasi | 17 |
| Brasov | 29 |

Pulls a four-row table from another tab or file, header included. Run in a Google Sheet (English US locale) on 2026-11-29. The result changes over time; this is the value on the run date.

```
=SUM(IMPORTRANGE("1l9m6VNhndPMXSx1F80hKNl4zeWRIBG8aj38weuYWP9A", "Sheet1!B2:B4"))
```

Result: `88`

Wrap the import in SUM to total a column that lives elsewhere. Run in a Google Sheet (English US locale) on 2026-11-29. The result changes over time; this is the value on the run date.

```
=INDEX(IMPORTRANGE("1l9m6VNhndPMXSx1F80hKNl4zeWRIBG8aj38weuYWP9A", "Sheet1!A1:B4"), 3, 1)
```

Result: `Iasi`

One cell out of the imported block: row 3, column 1. Run in a Google Sheet (English US locale) on 2026-11-29. The result changes over time; this is the value on the run date.

```
=VLOOKUP("Iasi", IMPORTRANGE("1l9m6VNhndPMXSx1F80hKNl4zeWRIBG8aj38weuYWP9A", "Sheet1!A1:B4"), 2, FALSE)
```

Result: `17`

Look up a value in the imported table as if it were local. Run in a Google Sheet (English US locale) on 2026-11-29. The result changes over time; this is the value on the run date.

```
=QUERY(IMPORTRANGE("1l9m6VNhndPMXSx1F80hKNl4zeWRIBG8aj38weuYWP9A", "Sheet1!A1:B4"), "select Col1 where Col2 > 20", 1)
```

Result: 

| City |
|---|
| Cluj |
| Brasov |

Filter the imported rows with QUERY. The 1 says the first row is a header. Run in a Google Sheet (English US locale) on 2026-11-29. The result changes over time; this is the value on the run date.

## Common errors

- A new source file returns #REF! until you click Allow access on the cell.
- The range is text and includes the tab name. A tab that does not exist, such as "Nope!A1:B2", returns #REF!.
- The destination needs free cells under and right of the formula. Any value in the way blocks the import.
- Very large ranges can show "Loading..." for a while. Import only the columns you need.

## Compared with Excel

Excel has no equivalent function. The closest match is a Power Query connection to another workbook.

## Related functions

- [IMPORTDATA](https://goingstellar.ro/reference/sheets/importdata/)
- [IMPORTXML](https://goingstellar.ro/reference/sheets/importxml/)
- [IMPORTHTML](https://goingstellar.ro/reference/sheets/importhtml/)
- [QUERY](https://goingstellar.ro/reference/sheets/query/)
- [VLOOKUP](https://goingstellar.ro/reference/sheets/vlookup/)
- [ARRAYFORMULA](https://goingstellar.ro/reference/sheets/arrayformula/)

## Sources

- [IMPORTRANGE (Docs Editors Help)](https://support.google.com/docs/answer/3093340)

