Analistable

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

Linking options in Google Sheets
NeedFormula
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.

Orders with customer details
Order IDCustomer IDAmountNameCountry
O-9001C-101120Bakery LuneFrance
O-9002C-10375Nordic SupplyDenmark
O-9004C-10460Not found

Join two separate files

  1. In the Orders file, add a tab called Customers_import.
  2. In A1, enter =IMPORTRANGE("customers file URL", "Customers!A1:C") and allow access.
  3. 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

Lookup functions for linking sheets
VLOOKUPXLOOKUP
Look left of the keyNoYes
Default matchApproximate unless FALSEExact
Not-found valueWrap in IFERRORBuilt in
Fill a column with ARRAYFORMULAYesYes

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.

Related guides