Table.PromoteHeaders
TablePromotes the first row of a table to column headers.
Syntax
Table.PromoteHeaders(table as table, optional options as nullable record) as tableParameters
| Name | Type | Required | Description |
|---|---|---|---|
table | table | Yes | The input table whose first row should become column headers. |
options | record | No | Optional record with a PromoteAllScalars field (default false) to control whether non-text values are converted to text for use as headers. |
Return Value
table — A 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])Alice | Widget A | East | |
|---|---|---|---|
| 1 | Bob | Gadget B | West |