There are two ways to join data with a live connection from one spreadsheet to another.
### Using VLOOKUP
You can use VLOOKUP to join one table to another. This is best when you have a static table or you have indeterminate rows in the table.
```
=ARRAYFORMULA(IFNA(VLOOKUP(A2:B,QUERY(IMPORTRANGE("<sheetID>", "Sheet1!A2:C")), {1,2,3},FALSE)))
```
You could allow indeterminate columns by substituting the `{1,2,3}` for `SEQUENCE(1, COLUMNS(IMPORTRANGE("<sheetID>", "Sheet1!A2:C")),2)` however this would require two imports. In this case, it might be best to import the database directly (use a `SELECT` statement in the query to exclude unnecessary data) to a blank sheet and do the lookup there.
### Using QUERY
You can use the `SELECT` statement in a `QUERY` to join each row one by one. This is best when you will be adding data directly to the table and don't want to re-run the join for every record each time you do.
```
=IFNA(QUERY(IMPORTRANGE("<sheetID>", "Sheet1!A2:C"), "SELECT * WHERE Col1 = '"&A2&"'"))
```
Copy the formula down (`Ctrl+D`) to each row in the original table. In this case, you use concatenation (`&`) to join the value in column A to the `SELECT` statement.
### Resources
- [Google Sheets: Join Tables using VLOOKUP & QUERY functions (Learn Google Sheets & Excel Spreadsheets)](https://www.youtube.com/watch?app=desktop&v=xkFGtKfEE2E)