You have two spreadsheets: orders.csv with customer IDs and totals, and customers.csv with customer names, emails, and regions. In Excel, merging them means writing fragile VLOOKUP or XLOOKUP formulas across tabs, fixing #N/A errors, and fighting crashes when files grow past 50,000 rows. In Python, it means spinning up a notebook just for a 30-second merge. With SnipFerry’s SQL Query on CSV, you can drop two (or five) CSV or Excel files straight into your browser, join them on any matching column, inspect unmatched rows, and download the merged CSV or JSON — with zero uploads to any server.

Step 1: Drop both CSV or Excel files into the workspace

Open SQL Query on CSV and drop both files onto the page (or click Upload and select multiple files at once). Each file automatically becomes a SQL table named after its filename — for example orders.csv becomes orders and customers.csv becomes customers. If you upload an .xlsx workbook with multiple worksheets, every worksheet loads as its own table.

Check the left schema sidebar to confirm column names and detected types (number, date, text). If a column name contains spaces or hyphens like Customer ID, wrap it in double quotes ("Customer ID") inside your query.

Step 2: Choose the right join type for your merge

Most spreadsheet merges need one of four patterns:

What you wantSQL joinExcel equivalent
Keep every row from File A and pull matching columns from File BLEFT JOINXLOOKUP / VLOOKUP
Keep only rows that exist in BOTH filesINNER JOINVLOOKUP + filter out #N/A
Keep every row from BOTH files, showing blanks where either side is missingFULL OUTER JOINNo simple Excel formula
Find rows in File A that are MISSING from File B (anti-join)LEFT JOIN … WHERE b.id IS NULLISNA(MATCH(…))

Worked example: merging orders.csv with customers.csv

Suppose orders.csv looks like this:

order_id,customer_id,amount,order_date
1001,C01,2400,2026-10-01
1002,C02,1500,2026-10-02
1003,C01,3100,2026-10-05
1004,C99,800,2026-10-06

And customers.csv holds customer details:

customer_id,name,city,tier
C01,Asha Rao,Pune,Pro
C02,Kabir Mehta,Bengaluru,Free
C03,Meera Nair,Kochi,Pro

1. VLOOKUP-style merge (LEFT JOIN)

SELECT
  o.order_id,
  o.order_date,
  o.amount,
  COALESCE(c.name, 'Unknown customer') AS customer_name,
  c.city,
  c.tier
FROM orders o
LEFT JOIN customers c
  ON o.customer_id = c.customer_id
ORDER BY o.order_id;

Every order survives — including order 1004 for missing customer C99, which gets cleanly labelled Unknown customer instead of silently vanishing.

2. Find unmatched rows (reconciliation & audits)

-- Orders with no matching customer record
SELECT o.*
FROM orders o
LEFT JOIN customers c ON o.customer_id = c.customer_id
WHERE c.customer_id IS NULL;

-- Customers who have never placed an order
SELECT c.*
FROM customers c
LEFT JOIN orders o ON o.customer_id = c.customer_id
WHERE o.order_id IS NULL;

This anti-join pattern is the fastest way to reconcile bank statements against invoices, find orphan SKUs, or spot inactive users before an export.

3. Join on multiple columns (composite keys)

Unlike basic VLOOKUP (which requires creating concatenated helper columns like A2&"|"&B2), SQL joins naturally on two or more columns:

SELECT a.*, b.target_revenue
FROM monthly_sales a
LEFT JOIN monthly_targets b
  ON a.region = b.region
 AND a.month  = b.month;

4. Stack two CSV files with identical columns (UNION ALL)

If you want to append jan_sales.csv and feb_sales.csv vertically rather than joining horizontally, use UNION ALL (or UNION to remove exact duplicate rows):

SELECT 'Jan' AS period, * FROM jan_sales
UNION ALL
SELECT 'Feb' AS period, * FROM feb_sales;

Four reasons CSV joins fail (and how to fix them in SQL)

  1. Hidden trailing spaces or mixed casing. "c01 " will not match "C01". Normalise both sides right inside the ON clause: ON LOWER(TRIM(o.customer_id)) = LOWER(TRIM(c.customer_id)).
  2. Leading zeros stripped in one file. If Excel saved 00742 as 742 in one CSV while the other kept "00742", cast or trim zeros deliberately: ON LTRIM(o.sku, '0') = LTRIM(c.sku, '0').
  3. Duplicate keys exploding your row count (many-to-many). If customers.csv accidentally lists C01 twice, every order for C01 duplicates — doubling your revenue sum! Always check uniqueness first with SELECT customer_id, COUNT(*) FROM customers GROUP BY 1 HAVING COUNT(*) > 1, or aggregate the right table in a CTE before joining.
  4. Null join keys never match each other. In SQL, NULL = NULL evaluates to unknown, never true. Filter or coalesce blank keys before merging.

Step 3: Export or chart your merged table

Once the result table looks right, click Download CSV to open it in Excel or Google Sheets, Download JSON for an API or web app, or click Chart the result to plot the merged dataset immediately without leaving the page. Because the SQL engine runs entirely inside your browser tab, payroll exports, CRM lists, and financial reconciliations never touch a remote server.

Want to go deeper on join mechanics or window functions? Read SQL Joins Explained, How to Query CSV Files with SQL, and How to Clean Messy CSV Data.