Compare & combine files · 4 min read

Power Query Append vs Merge: Stack Rows or Match Columns?

Two exports can belong together without representing the same kind of table. Decide what one output row should mean before choosing a combine command.

Write the result you need in one sentence

For this example, the desired result is one row per order, with its SKU and product name. January has two orders and February has one. Those tables belong underneath each other. The products table describes SKUs; stacking its rows below orders would create a table containing two different kinds of record.

Use the same question for your own files. Are both files customer lists from different branches, or is one a customer list and the other a list of purchases? File extensions do not answer that question. The meaning of a row does.

Your goalOperationBefore accepting the result
Add another month of ordersAppendSame column meanings; expected total rows
Add product names to ordersMerge on SKUUnique product key; unmatched orders reviewed
Find IDs absent from a new exportCompare keysSame snapshot scope and key definition
Monthly exports: January: A01, A02; February: B01. Appended orders: A01; A02; B01. Synthetic example: two plus one orders produces three order rows.
Illustrated example. Synthetic example: two plus one orders produces three order rows.

Prepare the inputs before either operation

Make working copies and label each source. Check that order_id means the same thing in both months. If one file uses customer_id where the other uses order_id, renaming the heading is not enough: those identifiers describe different entities.

Treat SKU as text on both sides of this example so 00123 remains the same key. Inspect blank keys and duplicate product SKUs before matching. Keep a source-file or month column if you will need to trace an unexpected row back to its export.

  1. Import each CSV with Data > From Text/CSV and select Transform Data.
  2. Check the delimiter and headers, then set the SKU columns to Text before a step converts their values.
  3. Name the queries January, February and Products. Keep the originals available for comparison.

Append the monthly records, then add descriptions

In Power Query, use Home > Append Queries > Append Queries as New to combine January and February. Choose the two order queries and inspect the resulting fields. The expected intermediate result contains three rows and the order columns; the products query does not belong in this append.

Select the combined orders query and use Merge Queries as New. Choose Products as the second table, select SKU in both previews and choose a left outer join to retain the order rows. Expand the new table column and select product_name. Inspect the result before loading it.

Expected merged result
order_id,sku,product_name
A01,00123,Blue mug
A02,00456,Small plate
B01,00123,Blue mug

Related help: Build a repeatable CSV folder import in Power Query

Use row counts to catch a bad match

Suppose someone adds a second product row for SKU 00123. Both A01 and B01 now have two possible matches, while A02 has one. Expanding all matches gives five rows, not three. That is a relationship problem to resolve, even if every cell looks plausible.

Do not remove duplicates from the final orders merely to recover the expected count. First decide whether the repeated product rows are mistakes, versions with an effective date, or genuinely separate records. A versioned lookup may require a second key or a date rule.

SKU matches: 00123: two products; 00456: one product. Expanded order rows: A01: 2 rows; A02: 1 row; B01: 2 rows; Total: 5. Synthetic calculation: duplicate lookup keys change the grain of the result.
Illustrated example. Synthetic calculation: duplicate lookup keys change the grain of the result.

Check missing descriptions separately

A blank expanded product_name can mean an order has no match, or that the matched product has no name. Compare the matching key as well as the description. Make a small exception list containing the order ID, original SKU and reason you could not enrich it.

Before replacing a previous report, confirm the order count, the number of unmatched keys and two manually selected product names. Repeat those checks after refreshing with a new month. These are checks of your business relationship, not evidence that every source row is correct.

What this example does and does not verify

The published sample demonstrates the arithmetic of stacking and matching a tiny dataset. Its expected three-row and five-row results were checked independently in Python. The menu instructions follow Microsoft documentation; no claim is made that this exact example was executed in every Excel version.

Column Harbor does not combine files or execute Power Query. Keep the work in your spreadsheet or another tool that supports the relationship you need. For a question about added or missing identifiers, a key comparison is usually a clearer first step than a full merge.

Common questions

Can I append files with different column names?

First establish a shared schema. Map genuinely equivalent headings deliberately, and decide what a missing field means. A successful append does not prove that the columns describe the same thing.

Does a left merge always keep the same row count?

It retains the left-side records, but expanding several matches for one key can produce several output rows. Confirm the lookup key is unique if you expect one result per order.

Should I sort both tables first?

Sorting is useful for inspection but does not make mismatched keys equal or remove duplicate keys. Focus first on key meaning, text types and the expected relationship.

Sources & method

Examples and diagrams use synthetic data. Application instructions follow the linked documentation; available menus and options can vary. Our sample checks do not establish behavior in every Excel or Google Sheets version. Read our AI-assisted editorial method.

Browse all field guides →