Table.ColumnNames

Updated on

Table.ColumnNames is a Power Query M function that retrieves the column names in a table as a list of text. The function returns a list of text containing the column names.

Compatible with: Power BI Service Power BI Desktop Excel Microsoft 365

Syntax

Table.ColumnNames( table as table ) as list

Description

Table.ColumnNames retrieves the column names of the table as a list of text values, listing every column in the table.

Examples

Find the column names of the table.

// Output: {"CustomerID", "Name", "Phone"}
Table.ColumnNames( 
    Table.FromRecords( {
        [CustomerID = 1, Name = "Bob", Phone = "123-4567"],
        [CustomerID = 2, Name = "Jim", Phone = "987-6543"],
        [CustomerID = 3, Name = "Paul", Phone = "543-7890"],
        [CustomerID = 4, Name = "Ringo", Phone = "232-1550"]
    } )
 )

Learn more about Table.ColumnNames in the following articles:

Other functions related to Table.ColumnNames are:

Contribute » | Contributors: Rick de Groot
Microsoft documentation: https://learn.microsoft.com/en-us/powerquery-m/table-columnnames