How to link two Google Sheets
By the Analistable team · Updated · 2 min read
To show data from another tab, use ='Tab name'!A1. To bring data from another file, use IMPORTRANGE. To join two sheets — add each customer's details next to their orders — match on a shared ID: =XLOOKUP(A2, Customers!A:A, Customers!B:B, "Not found"), or fill a whole column at once with =ARRAYFORMULA(IFERROR(VLOOKUP(A2:A, Customers!A:C, 2, FALSE), "")).
Part of our guide: How to combine data in Google Sheets
Three kinds of link
| Need | Formula |
|---|---|
| One cell from another tab | ='Customers'!B2 |
| A range from another file | =IMPORTRANGE("url", "Customers!A1:C") |
| Match rows by ID | =XLOOKUP(A2, Customers!A:A, Customers!B:B, "Not found") |
Join two tabs by ID
Orders tab: Order ID, Customer ID, Amount. Customers tab: Customer ID, Name, Country. In Orders, D2:
=ARRAYFORMULA(IF(B2:B="", , IFERROR(VLOOKUP(B2:B, Customers!A:C, {2, 3}, FALSE), "Not found")))This fills Name and Country for every order in one formula. {2, 3} returns the second and third columns of the Customers range.
| Order ID | Customer ID | Amount | Name | Country |
|---|---|---|---|---|
| O-9001 | C-101 | 120 | Bakery Lune | France |
| O-9002 | C-103 | 75 | Nordic Supply | Denmark |
| O-9004 | C-104 | 60 | Not found |
Join two separate files
- In the Orders file, add a tab called Customers_import.
- In A1, enter
=IMPORTRANGE("customers file URL", "Customers!A1:C")and allow access. - Use the lookup above against Customers_import.
Importing once and looking up locally is faster than putting IMPORTRANGE inside every lookup.
Limits of lookups
- One match per row: if a customer appears twice in Customers, only the first row is used.
- One direction: to list all orders per customer, use
=TEXTJOIN(", ", TRUE, FILTER(Orders!A:A, Orders!B:B=A2))— see TEXTJOIN for matched rows. - QUERY can't join two ranges, so lookups are the way to combine tables in Sheets.
Linking Google Sheets with Excel files too? Analistable connects both and joins them on the column you confirm. See joining spreadsheets for the concepts.
XLOOKUP vs VLOOKUP in Sheets
| VLOOKUP | XLOOKUP | |
|---|---|---|
| Look left of the key | No | Yes |
| Default match | Approximate unless FALSE | Exact |
| Not-found value | Wrap in IFERROR | Built in |
| Fill a column with ARRAYFORMULA | Yes | Yes |
Either works for linking; XLOOKUP is harder to get wrong. See VLOOKUP vs XLOOKUP vs INDEX MATCH.
Check the link
Count the rows that didn't find a match with =COUNTIF(D2:D, "Not found"). If it's high, compare a few IDs by eye: spaces, prefixes (“C-101” vs “101”) and numbers stored as text are the usual causes. Clean with TRIM or a helper column before linking.
Frequently asked questions
- How do I link data between two Google Sheets?
- Use ='Tab'!A1 for another tab, IMPORTRANGE for another file, and XLOOKUP or VLOOKUP to match rows by a shared ID.
- Can I join two tables in Google Sheets?
- Not with QUERY. Use VLOOKUP or XLOOKUP inside ARRAYFORMULA to bring columns from one table into another.
- Does a linked sheet update automatically?
- Yes. References, IMPORTRANGE and lookups recalculate when the source changes.