Table.ToRecords
TableConverts a table to a list of records, one record per row.
Syntax
Table.ToRecords(table as table) as listParameters
| Name | Type | Required | Description |
|---|---|---|---|
table | table | Yes | The table to convert. |
Return Value
list — A list of records where each record corresponds to a row in the table.
Remarks
Table.ToRecords is the inverse of Table.FromRecords. Each row becomes a record with field names matching the column names. This is useful when you need to iterate over rows as records or pass table data to a function expecting a list of records.
Examples
Example 1: Convert a table to a list of records
let
Records = Table.ToRecords(Sales),
First = Records{0}
in
FirstApplied Steps
The final output — retrieves the first record from the list (zero-based index 0), exposing the first Sales row as a record with all its field values.
OrderID | CustomerID | Amount | Region | OrderDate | Category | Quantity | |
|---|---|---|---|---|---|---|---|
| 1 | 1,001 | C001 | 250 | East | 1/15/2024 | Electronics | 5 |
Example 2: Round-trip via records
let
Records = Table.ToRecords(Sales),
BackToTable = Table.FromRecords(Records)
in
BackToTableCompatibility
✓ Power BI Desktop✓ Power BI Service✓ Excel Desktop✓ Excel Online✓ Dataflows✓ Fabric Notebooks