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"]
} )
)
Related articles
Learn more about Table.ColumnNames in the following articles:
- Change Column Type By Position in Power Query
You can easily change a column type by it’s relative position. This requires some basic editing of the M-Code and using the Table.ColumnNames formula. » Read more
Related functions
Other functions related to Table.ColumnNames are:
