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 operations
| Operation | What you get | SQL equivalent |
|---|---|---|
| Union | Rows from all sources stacked together. Sources should have compatible columns. | UNION ALL |
| Join | Only rows whose keys match in every source. | INNER JOIN |
| Lookup | Every row from the primary source, with matching fields from the others appended. | LEFT JOIN |
| Except | Rows 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
- Make sure each source is on its own input node. Use Add new source to add input nodes.
- Drag from the first node's + handle to create a new node.
- Drag from the second node's + handle and drop it onto that same new node. The node turns orange.
- 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,AmountCustomers:ID,Name,Channel
Goal: total order amount by customer first name.
- Create a flow and connect the input node to the
Orderstab. - Click Add new source and connect the new input node to the
Customerstab. - From
Customers, add a transformation with the intentextract first name from Name as first_name. Generate and approve it. - Drag a new node from
Orders, then drop a connection from the transformed customers node onto it. In Merge config, choose Lookup, setOrdersas the primary source, and add the keysCustomerId↔ID. - From the merge node, add a transformation:
total Amount by first_name. Visualize it to check the result.
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
| Message | Fix |
|---|---|
| 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 keys | Choose a key from every source for each key row. |
| Union has many empty cells | The sources' column names differ. Add a transformation before the merge to rename columns so they match. |