Power Query course · Lesson 9 of 17
Append queries: stacking tables
Stack monthly or regional tables with Append Queries, handle columns that do not match, tag each row with its source and append every table in a workbook.
Append puts the rows of one table under the rows of another. It is the answer whenever the same kind of data arrives in pieces: one sheet per month, one file per branch, one export per sales channel. In a worksheet you would copy and paste, or use VSTACK. In Power Query the stacking is a step, so when a piece changes, the combined table updates on refresh.
This lesson covers appending a handful of named queries. When the pieces are files in a folder, the folder method in Combine files from a folder is even better, but it builds on exactly the same idea.
The sample: two shop exports
| A | B | C | D | |
|---|---|---|---|---|
| 1 | Date | Receipt | Item | Amount |
| 2 | 2026-04-01 | A-1101 | Espresso beans 1kg | 18.9 |
| 3 | 2026-04-01 | A-1102 | Milk frother | 34.5 |
| 4 | 2026-04-02 | A-1103 | Paper filters | 3.2 |
Before, query 'Shop_Athens': the Athens shop's April sales.
| A | B | C | D | E | |
|---|---|---|---|---|---|
| 1 | Date | Receipt | Item | Amount | Cashier |
| 2 | 2026-04-01 | T-2201 | Espresso beans 1kg | 18.9 | Nikos |
| 3 | 2026-04-03 | T-2202 | Grinder C40 | 229 | Eleni |
Before, query 'Shop_Thessaloniki': the same columns plus a Cashier column.
Append Queries as New
- Create a query for each table (for tables in this workbook: click inside each and choose Data › From Table/Range, then Close & Load To… › Only Create Connection).
- In the editor choose Home › Combine › Append Queries › Append Queries as New. (From Excel you can also use Data › Get Data › Combine Queries › Append.)
- Choose Two tables, pick
Shop_Athensas Primary table andShop_Thessalonikias Table to append to the primary table. - Click OK. A new query called
Append1appears. Rename itSales_All.
| A | B | C | D | E | |
|---|---|---|---|---|---|
| 1 | Date | Receipt | Item | Amount | Cashier |
| 2 | 2026-04-01 | A-1101 | Espresso beans 1kg | 18.9 | null |
| 3 | 2026-04-01 | A-1102 | Milk frother | 34.5 | null |
| 4 | 2026-04-02 | A-1103 | Paper filters | 3.2 | null |
| 5 | 2026-04-01 | T-2201 | Espresso beans 1kg | 18.9 | Nikos |
| 6 | 2026-04-03 | T-2202 | Grinder C40 | 229 | Eleni |
After: five rows. Columns are matched by name; Cashier exists only in the second table, so it is null for Athens rows.
let
Source = Table.Combine({Shop_Athens, Shop_Thessaloniki})
in
SourceAppend Queries (without as New) adds the append as a new step at the end of the current query instead of creating a new query. That is fine for quick work, but Append as New keeps each source query untouched and reusable, which makes larger workbooks easier to understand.
Three or more tables
Choose Three or more tables in the dialog. Move queries from Available tables to Tables to append with Add >>, and set their order with the arrows. The order decides only the row order of the result.
How columns are matched
- Columns are matched by name, not by position. Different column order in the sources is not a problem.
- Names must match exactly, including case and spaces.
Amountandamount(with a trailing space) become two separate columns, each half full of nulls. - A column that exists in only some tables is filled with null in the others.
- The result's columns follow the order of the first table, then any extra columns from later tables.
Amount in January, Amount EUR in February. The append does not fail; it quietly produces two half-empty columns, and a total on Amount is too low. After every append, look at the column quality bar (View › Column quality) for unexpected empty percentages.Fix mismatched names in the source queries before appending, with a rename step. If the variation is systematic, for example inconsistent case, transform all headers at once with a step such as:
= Table.TransformColumnNames(Source, each Text.Proper(Text.Trim(_)))Tag each row with its source
After stacking, you often need to know where a row came from. Add a custom column in each source query before appending: Add Column › Custom Column, name Shop, formula "Athens". Do the same with "Thessaloniki" in the other query. Now the combined table can be grouped or filtered by shop.
= Table.AddColumn(#"Changed Type", "Shop", each "Athens", type text)Appending every table in the current workbook
Suppose each month someone adds a sheet with a new table named Sales_2026_01, Sales_2026_02 and so on. Instead of appending them by hand, read the list of tables in the workbook itself:
- Choose Data › Get Data › From Other Sources › Blank Query.
- In the formula bar type
= Excel.CurrentWorkbook()and press Enter. You get a table withContentandNamecolumns, one row per table or named range in the workbook. - Filter
Namewith Text Filters › Begins WithSales_. - Click the expand icon on
Content(two arrows in the header), untick Use original column name as prefix, and click OK. - Set the data types and rename the query
Sales_All.
let
Source = Excel.CurrentWorkbook(),
SalesTables = Table.SelectRows(Source, each Text.StartsWith([Name], "Sales_")),
Expanded = Table.ExpandTableColumn(SalesTables, "Content", {"Date", "Receipt", "Item", "Amount"}),
Typed = Table.TransformColumnTypes(Expanded, {{"Date", type date}, {"Amount", type number}})
in
TypedExcel.CurrentWorkbook(). If its name matched your filter (say you named it Sales_All), the next refresh would append the output to itself and the rows would double each time. Use a filter that cannot match the output, such as Sales_2, or name the output table differently, for example All_Sales.Append versus Merge
| Append | Merge | |
|---|---|---|
| Direction | Adds rows (stacks vertically) | Adds columns (side by side) |
| Matching | Column names | Values in key columns |
| Typical use | Months, branches, channels | Look up product, customer or price details |
| Excel equivalent | VSTACK or copy-paste | XLOOKUP |
If you are unsure, ask whether the second table contains more of the same rows (append) or more information about the same rows (merge, see Merge queries: every join kind explained).
Staging queries
The source queries Shop_Athens and Shop_Thessaloniki do not need to be on a sheet. Right-click each in Queries & Connections, choose Load To…, and pick Only Create Connection. Only Sales_All is loaded. In the editor, the italic name of a query in the Queries pane shows that it is not loaded. You can also group helper queries into folders: right-click › Move To Group › New Group…, for example Staging.
Check yourself
1. How does Append match columns?
Columns are matched by their exact names.
2. One table has Cashier, the other does not. What appears in Cashier for rows from the second table?
Missing columns are filled with null.
3. What M function does Append write?
Table.Combine takes a list of tables.
4. A query appends all tables whose name begins with Sales_ and loads to a table named Sales_All. What happens on refresh?
The output table matches the filter and is read back in.
5. Which right-click option creates a query that follows changes in the original?
A reference uses the original query as its source.