Table.FromRecords
Makes a table from a list of records: each record a row, each field a column.
Group: Table. Power Query M has it too: a query that uses it is written as in Power BI.
Syntax
Table.FromRecords(records as list, optional columns as any, optional missingField as nullable number) as table
| Parameter | Type | Description |
|---|---|---|
records | list | The rows as records. |
columns | any optional | The column names as a list, or a table type; the first record's fields when left out. |
missingField | nullable number optional | MissingField.UseNull to give null where a record lacks one of the columns; an error otherwise. |
Returns
table. A table with one row per record.
Remarks
- Fields are matched by name: their order in each record doesn't matter.
Examples
Two products
Table.FromRecords({[Product = "Chair", Price = 50], [Price = 120, Product = "Desk"]})
| Product | Price |
|---|---|
| Chair | 50 |
| Desk | 120 |
A missing field as null
Table.FromRecords({[Product = "Chair", Price = 50], [Product = "Desk"]}, {"Product", "Price"}, MissingField.UseNull)
| Product | Price |
|---|---|
| Chair | 50 |
| Desk | null |