Table.ToRecords is a Power Query M function that converts a table to a list of records. The function returns a list of records representing the rows of the table.
Compatible with: Power BI Service Power BI Desktop Excel Microsoft 365
Syntax
Table.ToRecords( table as table ) as list
Description
Converts a table, table
, to a list of records.
Examples
Convert the table to a list of records.
Table.ToRecords(
Table.FromRows(
{
{1, "Bob", "123-4567"},
{2, "Jim", "987-6543"},
{3, "Paul", "543-7890"}
},
{"CustomerID", "Name", "Phone"}
)
)
/* Output:
{
[CustomerID = 1, Name = "Bob", Phone = "123-4567"],
[CustomerID = 2, Name = "Jim", Phone = "987-6543"],
[CustomerID = 3, Name = "Paul", Phone = "543-7890"]
}
*/
Related articles
Learn more about Table.ToRecords in the following articles:
- Replace Values in Power Query M (Ultimate Guide)
Learn how to replace values in Power Query. Look into conditional replacements, replacing in multiple columns, case sensitivity and more! » Read more
Related functions
Other functions related to Table.ToRecords are:
- Table.Partition
- Table.PartitionValues
- Table.Split
- Table.SplitAt
- Table.ToColumns
- Table.ToList
- Table.ToRows
- Table.Transpose
