Renaming Table Column Headings
This page shows how to rename all of a table’s column headings in one step, rather than one column at a time.
When the headings need changing
Section titled “When the headings need changing”Sometimes the columns of an existing table need new names. A common case is a model that compares order dates with delivery dates. It needs two calendar tables that can be filtered separately, and their columns are easier to tell apart if one table’s headings start with Order and the other’s with Delivery.
The prefixes could be typed into each heading by hand, but the renaming can be automated instead. There are two ways to do it, and both use M, the language behind Power Query.
1. Make a copy of the Order Calendar query
Section titled “1. Make a copy of the Order Calendar query”The starting point is an Order Calendar query like this one:

- In the Queries pane on the left, right-click Order Calendar and choose Reference.

This creates a new query, Order Calendar (2), which starts from the output of Order Calendar.

- Rename the new query to Delivery Calendar.

2. Build a list of old and new headings
Section titled “2. Build a list of old and new headings”The new query’s headings are the ones to rename.
- In the Delivery Calendar query, click the fx button beside the formula bar to add a step, and enter this formula:
= Table.ColumnNames(Source)The step returns a list of the table’s column headings.

- Click To Table on the Transform tab to turn the list into a table.

- Add a custom column with the formula below, which puts Del and a space in front of each heading:
![The Custom Column dialog creating a column called Custom with the formula “Del “ & [Column1]](/_astro/renaming-table-headings-7.C-iL2jfY_Z10FUdE.webp)
The table now has each old heading beside its new one.

- Turn the table into a list of lists by wrapping the custom column step’s formula in
Table.ToRows, like this:
= Table.ToRows(Table.AddColumn(#"Converted to Table", "Custom", each "Del " & [Column1]))The step now returns a list with one item per heading, and each item is itself a list holding the old name and the new one.

3. Rename the columns from the list of lists
Section titled “3. Rename the columns from the list of lists”- Rename this step to ListOfLists in Applied Steps.

- Add one more step with this formula:
= Table.RenameColumns(Source, ListOfLists)Table.RenameColumns takes the original table from the Source step and renames each column according to its pair in the list. Every heading now starts with Del:

4. A shorter alternative
Section titled “4. A shorter alternative”There is a quicker way, though it is less flexible. The list-of-lists method can take its pairs of names from anywhere, such as a mapping table kept in Excel, whereas this one applies the same change to every heading.
Add this formula as the step straight after Source:
= Table.TransformColumnNames(Source, each "Del " & _)It gives the same result in a single step, with Del in front of every column heading.