Table.ColumnNames

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

Returns the column names in the table table as a list of text.

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:

BI Gorilla Blog

Last update: August 25, 2023 | Contribute » | Contributors: Rick de Groot
Microsoft documentation: https://learn.microsoft.com/en-us/powerquery-m/table-columnnames
© 2023 BI Gorilla. All rights reserved. Content derived from Microsoft documentation is property of Microsoft Corp.