Table.ToRecords

Updated on

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

Table.ToRecords converts the given table, table, into a list of records, with each table row becoming a record.

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"]
}
 */ 

Learn more about Table.ToRecords in the following articles:

Other functions related to Table.ToRecords are:

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