Skip to main content

Combine sources

Real questions often span more than one dataset, such as orders in one sheet and customers in another. In Flow, connecting two or more nodes into one node creates a merge node (orange), where you choose how the data is combined.

Merge nodes in a flow

Merge operations​

OperationWhat you getSQL equivalent
UnionRows from all sources stacked together. Sources should have compatible columns.UNION ALL
JoinOnly rows whose keys match in every source.INNER JOIN
LookupEvery row from the primary source, with matching fields from the others appended.LEFT JOIN
ExceptRows from the primary source that have no match in the others.Anti join

Union is the default. Join, Lookup, and Except need join keys: the columns that identify a match, such as CustomerId = ID.

Create a merge node​

  1. Make sure each source is on its own input node. Use Add new source to add input nodes.
  2. Drag from the first node's + handle to create a new node.
  3. Drag from the second node's + handle and drop it onto that same new node. The node turns orange.
  4. Click the merge node. In Merge config on the Selected Node tab, set:
    • Primary source: the dataset whose rows you're keeping (for Lookup and Except).
    • Operation: Union, Join, Lookup, or Except.
    • Join keys: click Keys and choose the matching column from each source. Every source needs the same number of keys.

A plain-English explanation under the settings confirms what the merge will do.

To remove one of the incoming connections, click that edge and choose Delete this connection.

Walkthrough: sales by customer first name​

This example uses a public sample Google Sheet with two tabs:

  • Orders: OrderId, CustomerId, Product, Amount
  • Customers: ID, Name, Channel

Goal: total order amount by customer first name.

Orders tab Customers tab

  1. Create a flow and connect the input node to the Orders tab.
  2. Click Add new source and connect the new input node to the Customers tab.
  3. From Customers, add a transformation with the intent extract first name from Name as first_name. Generate and approve it.
  4. Drag a new node from Orders, then drop a connection from the transformed customers node onto it. In Merge config, choose Lookup, set Orders as the primary source, and add the keys CustomerId ↔ ID.
  5. From the merge node, add a transformation: total Amount by first_name. Visualize it to check the result.

Result: amount by first name

Join or Lookup?

Use Lookup when every row of your main dataset must be kept, even if some have no match. For example, orders from customers missing from the CRM. Use Join when unmatched rows should be dropped.

Troubleshooting​

MessageFix
Needs more sources.A merge node needs at least two incoming edges.
Operation join requires join keys.Add at least one key pair under Join keys.
Every node should have the same number of join keysChoose a key from every source for each key row.
Union has many empty cellsThe sources' column names differ. Add a transformation before the merge to rename columns so they match.