Combine Files in Power Query Without Helper Queries

Nov 19, 2026 • 8 min read

Click the Combine Files icon in Power Query and a whole collection of helper queries appears. There is a sample file, a transformation query, a function, and a parameter. They all have a job, but do we really need them?

No. We can combine Excel files from a folder inside a single query. The alternative is to read each workbook into a nested table, apply any transformations we need, and then combine the results.

We will work through two examples. The first combines straightforward stock movement files. The second handles budget files with a more challenging layout, where the data needs transforming before it can be combined.

To follow along, get the files through the free Insiders Programme. The file reference is 0344 PQ Combine Files.

What You'll Learn

  • Read Excel files into nested tables without creating the standard Combine Files helper queries.
  • Use Table.Combine to stack clean worksheet data without a fixed expansion column list.
  • Transform nested budget tables before combining them when month headings differ between files.
  • Adapt interface-generated M code with each and underscore to transform every nested table.

Table of Contents

What do the standard Combine Files helper queries do?

Before replacing the standard method, it helps to understand what it does.

Our first example has three Excel files in a Stock folder. Each file already has a useful data structure:

  • A single header row.
  • One record per row.
  • The same columns in the same order.
  • No unwanted rows above the headers.

Using the standard method, we would take these steps in Power Query Editor:

  1. Right-click the Queries pane and select New Query > File > Folder.
  2. Navigate to the Stock folder and click Open.
  3. Click Transform Data to display the folder’s files.
  4. Click the double down arrow Combine Files icon in the Content column.
  5. Choose the first file as the sample and select the Stock Movement worksheet.
  6. Click OK.

Power Query creates a query based on the selected sample file. The Transform Sample File query navigates into the worksheet and promotes its first row to headers.

Those transformations are then placed into a function. Power Query applies that function to every file in the folder and stacks the resulting tables together.

That gives us a tidy dataset. The helper queries are not unnecessary clutter within that method; they are how the method works. But we can perform the same type of work without creating separate queries.

Example 1: Combine files that already have a clean layout

The alternative starts in exactly the same place: connect to the folder and click Transform Data. This time, leave the Combine Files icon alone.

1. Read each file with Excel.Workbook

The folder query contains one row per file. Its Content column holds the binary contents of each file, which is exactly what Excel.Workbook needs.

Select Add Column > Custom Column. Name the new column Excel and enter:

Excel.Workbook([Content])

Click OK. Each cell in the new column now contains a table describing the contents of that workbook.

Right-click the Excel column and select Remove Other Columns.

The important distinction is that we have not combined the worksheet data yet. We have connected to each workbook and kept its contents nested inside the query. Microsoft’s Excel.Workbook documentation provides the function’s arguments and options.

2. Expand the workbook contents

Click the expand icon on the Excel column. Clear Use original column name as prefix, then click OK.

The query now lists the workbook contents, including a Data column containing the worksheet tables.

Power Query listing workbook objects with Data, Item, Kind, and Hidden columns
The Data column holds the worksheet tables we will combine.

If a workbook contains multiple worksheets, they appear as separate entries. At this stage, filter the list to retain only the sheets you want.

For this example, select the Data column, right-click it, and choose Remove Other Columns. We are left with three nested tables, one from each file.

3. Combine the nested tables without a fixed column list

We could click the expand icon on the Data column. In this example, the expansion dialog lists Column1 through Column9.

However, that action generates a formula containing those nine column names explicitly. The expansion is tied to the selected column list, so additional columns would not automatically be included.

Instead, use Table.Combine. This function accepts a list of tables and stacks them together.

For clarity, rename the step containing only the Data column to DataTables. Click the fx button beside the formula bar to add a step, then enter:

= Table.Combine(DataTables[Data])

If you keep Power Query’s automatically generated step name instead, substitute that name for DataTables.

Here is how the formula works:

  • DataTables references the previous step.
  • [Data] extracts that column as a list of nested tables.
  • Table.Combine combines the tables in that list.

We now have all three files stacked together, without an explicit nine-column expansion list.

4. Promote the headers and remove repeated header rows

There is one small problem: every worksheet brought its header row with it. In the example, those headers appear in rows 1, 22, and 43.

Because the files share the same layout, this is simple to handle:

  1. Select Home > Use First Row as Headers.
  2. Open the filter on the Date column.
  3. Clear the text value Date to remove the remaining header rows.
  4. Click OK.

And that is it. All three files are combined inside one query, without any helper queries.

This combine-first approach works here because the source columns already line up. We only needed to stack the data and deal with the repeated headers. More complex layouts need a slightly different order of operations.

Example 2: Transform budget files before combining them

The Budget folder also contains three files, but each file represents a different year. The worksheets use a cross-tab layout, with account information on the left and months across the columns.

Excel budget worksheet with account details on the left and monthly budget figures across columns
The month columns differ between years, so each worksheet needs transforming before we combine it.

If we immediately stack the raw worksheet data, a generic column such as Column4 contains different dates in different parts of the result. In one file, its header row contains 30 April 2021. In the next, it contains 30 April 2022.

We do not want those dates left as repeated header values within the combined data. Instead, we need to:

  1. Promote the headers inside each worksheet table.
  2. Unpivot the month columns inside each worksheet table.
  3. Combine the transformed tables.

The key is to perform the transformations on each nested table, not on the outer table that holds them.

1. Create the nested worksheet tables

Repeat the folder connection process, this time selecting the Budget folder:

  1. Connect to the folder and select Transform Data.
  2. Add a custom column named Excel using Excel.Workbook([Content]).
  3. Keep only the Excel column.
  4. Expand it, clearing Use original column name as prefix.
  5. Filter to the required worksheets if necessary.
  6. Keep only the Data column.

Rename this final preparation step DataTables so the formulas below are easy to follow.

If you have already tried expanding the Data column, delete that expansion step. We need the worksheet tables to remain nested while we transform them.

2. Borrow the header-promotion code from the interface

We do not have to remember every M function. A useful technique is to let Power Query generate a transformation, copy its code, and adapt it. I call this code stealing.

To get the header-promotion expression:

  1. Temporarily click Home > Use First Row as Headers.
  2. If Power Query adds a Changed Type step, remove it.
  3. Select the Promoted Headers step and copy its formula.
  4. Delete the temporary Promoted Headers step.

We are not trying to promote the outer table’s headers. We are simply borrowing the generated Table.PromoteHeaders expression.

3. Promote headers inside every nested table

Return to the DataTables step and click fx to add a new step. Enter:

= Table.TransformColumns(
    DataTables,
    {
        {"Data", each Table.PromoteHeaders(_, [PromoteAllScalars=true])}
    }
)

Rename the new step PromotedTables.

Table.TransformColumns applies a transformation to the values in a specified column. Here, those values happen to be tables.

  • DataTables is the outer table we are working on.
  • "Data" identifies the column to transform.
  • each applies the expression to every value in that column.
  • _ represents the current value, which is one nested worksheet table.
  • Table.PromoteHeaders promotes the first row within that worksheet table.

Replacing the copied expression’s previous-step reference with an underscore is essential. Otherwise, the expression refers to the outer query step instead of the current nested table.

The outer preview still looks much the same: a Data column containing tables. Select a nested table cell to inspect its contents, and you should see that its headers have been promoted.

4. Borrow the unpivot code

Next, we need the expression for unpivoting the month columns. Again, the interface can generate it for us.

Select an earlier step with multiple columns, right-click the Name column, and choose Unpivot Other Columns. Copy the generated Table.UnpivotOtherColumns formula, then delete the temporary step and return to PromotedTables.

That copied formula is a starting point, not the finished transformation. It refers to the Name column because that is what we selected to generate the code. Our nested budget tables have different identifying columns.

5. Unpivot each budget table

Click fx and enter the following expression, matching the identifying column names exactly to the headers in your files:

= Table.TransformColumns(
    PromotedTables,
    {
        {
            "Data",
            each Table.UnpivotOtherColumns(
                _,
                {"Account Code", "Account", "Cost Center"},
                "Date",
                "Value"
            )
        }
    }
)

This keeps Account Code, Account, and Cost Center as identifying columns. All other columns are unpivoted into two fields:

  • Date: the former month column heading.
  • Value: the budget amount from that month’s column.

Notice the underscore again. We want to unpivot each nested table, not the outer table.

If you paste the borrowed expression without changing its retained-column list, you will get an error because it still references Name. Replace that with the actual identifying columns inside the budget tables.

We also change the default output heading from Attribute to Date, which makes the result easier to understand. Microsoft’s Table.UnpivotOtherColumns reference explains these arguments in more detail.

Select one of the nested tables to check the result. Instead of a separate column for every month, it should now have the same five-column structure as the other transformed files.

6. Expand the transformed data

Now we can safely combine the results:

  1. Click the expand icon on the Data column.
  2. Select the resulting columns.
  3. Clear Use original column name as prefix.
  4. Click OK.
Power Query showing combined budget data with Account Code, Account, Cost Center, Date, and Value columns

Each year’s months are now values in the Date column, rather than competing column headings. The transformed files combine into one consistent dataset.

The important decision: Transform before or after combining?

Both examples use the same underlying idea: keep the worksheet data in nested tables until it is ready to combine.

The difference is when we perform the cleanup:

  • Clean, matching layouts: combine the raw tables with Table.Combine, then promote the first header row and remove repeated headers.
  • Cross-tab layouts with different month headings: use Table.TransformColumns to promote headers and unpivot each nested table before expanding the results.

The standard Combine Files method is still useful. But it is not the only option. With Excel.Workbook, Table.Combine, and Table.TransformColumns, we can read, transform, and combine a folder of Excel files while keeping the entire process in one query.

Build your Power Query skills

For a structured learning path, our Excel Academy includes Power Query Pro for building confidence with the user interface, Demystifying M for writing transformations from scratch, and Power Query Quick Steps, our library of pre-made custom functions for advanced transformations.

Share

Excel Off The Grid

I help you reduce repetitive Excel work with practical guides to formulas, Power Query, reporting, and automation.

© 2026 Excel Off The Grid
Powered by Convella