Table.PromoteHeaders

Table

Promotes the first row of a table to column headers.

Examples on this page use shared sample tables. View them to understand the input data before reading the examples below.

Syntax

Table.PromoteHeaders(table as table, optional options as nullable record) as table

Parameters

NameTypeRequiredDescription
tabletableYesThe input table whose first row should become column headers.
optionsrecordNoOptional record with a PromoteAllScalars field (default false) to control whether non-text values are converted to text for use as headers.

Return Value

tableA table where the first row has been used as column names.

Remarks

Table.PromoteHeaders takes the values from the first row of a table and uses them as column names, then removes that row from the data. This is commonly used when importing data from CSV or Excel files where the first row contains column headers that Power Query did not automatically detect.

When importing from Excel or CSV, explicitly set the Culture in the options record (e.g., [PromoteAllScalars = true]) to avoid ambiguity. Without this, date and number values in the header row may not convert to text consistently across different locales.

After promoting headers, column types are typically set to type any. Always follow with a Table.TransformColumnTypes step to assign proper types.

Examples

Example 1: Promote first row to headers

let
    Demoted = Table.DemoteHeaders(
        Table.SelectColumns(Table.FirstN(Sales, 2), {"CustomerName", "Product", "Region"})
    )
in
    Table.PromoteHeaders(Demoted, [PromoteAllScalars = true])
Result
Alice
Widget A
East
1BobGadget BWest

Compatibility

Power BI Desktop Power BI Service Excel Desktop Excel Online Dataflows Fabric Notebooks