Many workflows fetch data from two places and must join them, like a lookup across two spreadsheets.
The Merge node waits for data on two or more inputs and combines it. Its modes:
- Append: output all items from input 1, then all from input 2 (and more inputs if added). Use it to rejoin branches after an If node.
- Combine with Matching Fields: pair items whose field values match, like matching customers from your CRM with invoices from billing by
email. You choose whether to keep only matches, non-matches, or everything. This is the n8n version of a spreadsheet lookup (VLOOKUP). - Combine by Position: pair the first item of input 1 with the first item of input 2, and so on. Only safe when both lists are in the same order.
- Combine with All Possible Combinations: every item of one input with every item of the other.
- SQL Query: write a query in SQL (a language for asking questions of tables) using
input1,input2. - Choose Branch: output the data of one input only, used to wait for both branches to finish.
Example: a Schedule trigger fetches today's orders from Shopify and all customers from a Google Sheet in two branches. A Merge node in Matching Fields mode joins them on email, so each order item now carries the customer's tier.
Gotchas:
- The order of the inputs matters for some options; check which branch goes into input 1.
- If one input receives no items, the result may be empty. Test with realistic data on both sides.
- Field names must match exactly, including capitalisation, or nothing pairs up.
Remember
- Append stacks items; Combine joins them
- Matching Fields is a lookup between two data sources
- Check input order and field names when results are empty
Watch out for
- Using Combine by Position on lists that are not in the same order, which pairs the wrong records.