How to Join Two Excel Files by a Key Column (VLOOKUP in Python, Free Tool)

Join two Excel files by a key column with Python tutorial showing pandas merge VLOOKUP XLOOKUP style joins and Excel automation
Combine data from two Excel files using Python and pandas with powerful join and merge operations. This tutorial explains how to match records using a common key column, perform VLOOKUP-style and XLOOKUP-style lookups, handle unmatched values, choose different join types (inner, left, right, and outer), and export the merged results back to Excel. Ideal for data analysts, developers, accountants, Excel users, and business professionals who want to automate data integration and eliminate manual lookups.

Key takeaways

  • A join combines two files side by side on a key — unlike a merge, which stacks rows on top of each other.
  • Excel Join is free and open-source (MIT), built in Python with pandas.
  • It replaces VLOOKUP / XLOOKUP across an entire file, in one step.
  • Four join types: left (default), inner, right, outer.
  • It reports how many rows matched — and unmatched rows keep blank lookup values.

To join two Excel files by a matching column, run a free tool called Excel Join, which pulls columns from a lookup table into your main table in one command — the automation of VLOOKUP / XLOOKUP. Match rows on a shared key, choose a left, inner, right, or outer join, and get a report of how many rows matched.

Join vs. VLOOKUP vs. merge — what's the difference?

VLOOKUP looks up one value at a time and is slow and fragile across big files. Merging (stacking) puts files on top of each other — more rows, same columns. A join is different: it matches rows by a key and adds the columns from a second file. That's exactly what you want when you have orders in one file and customer details in another and need them together.

orders customers customer_id join on key joined.xlsx — orders + customer details order_idcustomer_idamountnamecity 1001C1250Acme CorpLondon 1002C2180Beta LLCParis 1005C9410(no match)--
Two tables joined on customer_id — each order gains its customer's name and city.

How to install the tool (2 minutes)

You need Python 3.9 or newer. Clone the repository and install its dependencies:

git clone https://github.com/Synth88Labs/excel-tool-join.git
cd excel-tool-join
pip install -r requirements.txt

Get Excel Join on GitHub (free)

How to join two Excel files — step by step

Step 1 — The VLOOKUP-style left join

Keep every row from your main file and pull in matching columns from the lookup file:

python join_excel.py orders.csv customers.csv --on customer_id -o joined.xlsx

Every order now has its customer's name and city. Orders with no matching customer keep blank lookup values (just like a VLOOKUP that returns nothing).

Step 2 — Keep only matching rows (inner join)

python join_excel.py orders.csv customers.csv --on customer_id --how inner

Step 3 — Different key names, or fewer columns

Use --left-on / --right-on when the key column has different names, and --columns to bring in only what you need:

python join_excel.py orders.xlsx people.xlsx --left-on cust_id --right-on id --columns name
Match report: after each run the tool prints how many rows matched, how many were left-only, and how many were right-only — so you immediately see if some keys didn't line up.

The four join types

TypeKeepsUse when…
left (default)Every left row; adds right columns where matchedYou want a VLOOKUP — enrich your main file
innerOnly rows matched in both filesYou only care about records that exist in both
rightEvery right rowThe lookup file is the one you want complete
outerAll rows from both filesYou want everything, matched or not

Real work use cases

  • Enrich orders — add customer names, regions, or segments from a customer list.
  • Add prices or categories — join a product catalog onto a sales file.
  • Combine systems — merge exports from two tools on a shared ID.
  • Fill in details — attach employee or account info to a transaction log.
  • Find non-matches — a left join's blanks reveal keys with no lookup record.

Common mistakes to avoid

  • Mismatched key formatting. "C1" won't match "c1 " or 1. Clean and standardize the key column in both files first.
  • Duplicate keys in the lookup file. If the right file has repeated keys, rows multiply — make sure the lookup key is unique.
  • Wrong join type. A left join keeps unmatched rows (with blanks); an inner join drops them. Pick the one that matches your intent.
  • Overlapping column names. Columns with the same name in both files get a _right suffix — rename beforehand for cleaner output.
🔗 Keys not matching? Standardize both files first with the free Excel Data Cleaner. Need to stack files instead of join them? Use the Excel/CSV Merger.

Frequently asked questions

How do I do a VLOOKUP between two Excel files?

Run python join_excel.py main.csv lookup.csv --on key_column. The tool matches rows on the key and adds the lookup file's columns to your main file — a whole-file VLOOKUP.

What's the difference between join and merge?

A join combines two files side by side by matching a key (more columns). A merge stacks files on top of each other (more rows). Use this tool to join; use the Excel/CSV Merger to stack.

Can the key column have different names in each file?

Yes. Use --left-on and --right-on to specify the key column name in each file.

What happens to rows that don't match?

In a left join they're kept with blank lookup values. In an inner join they're dropped. The tool reports how many rows matched.

Is Excel Join free?

Yes. It's open-source under the MIT license, free for personal and commercial use. The source is on GitHub.

Do I need Excel installed?

No. It reads and writes files with Python libraries, so it works without Microsoft Excel installed.

Can I join CSV and Excel files together?

Yes. It reads .csv, .xlsx, and .xls, so you can join any mix.

Summary

VLOOKUP is slow and breaks on big files. Excel Join combines two spreadsheets on a key column in one command — a whole-file VLOOKUP with left, inner, right, and outer joins, plus a match report. It's free, open-source, and works without Excel installed.

Download Excel Join free on GitHub