Table.ExpandTableColumn
TableExpands a column of nested tables into individual columns in the parent table.
Syntax
Table.ExpandTableColumn(table as table, column as text, columnNames as list, optional newColumnNames as nullable list) as tableParameters
| Name | Type | Required | Description |
|---|---|---|---|
table | table | Yes | The input table containing a column of nested tables. |
column | text | Yes | The name of the column containing nested tables to expand. |
columnNames | list | Yes | A list of column names from the nested table to extract. |
newColumnNames | list | No | Optional list of new names for the expanded columns. If omitted, the original nested column names are used. |
Return Value
table — The input table with the specified nested table column expanded into separate columns.
Remarks
Table.ExpandTableColumn takes a column that contains nested tables (typically the result of Table.NestedJoin or Table.Group) and flattens selected columns from those nested tables into the parent table.
Use the optional newColumnNames parameter to rename the expanded columns in the same step, rather than adding a separate Table.RenameColumns call. This keeps your query concise and reduces unnecessary steps.
Only expand the columns you actually need. Expanding all columns from a nested table and then removing most of them wastes processing time.
Examples
Example 1: Expand columns from a join result
let
Joined = Table.NestedJoin(
Table.SelectColumns(Table.FirstN(Sales, 3), {"CustomerName", "Product"}),
"CustomerName", Customers, "Name",
"CustData", JoinKind.LeftOuter
)
in
Table.ExpandTableColumn(Joined, "CustData", {"City", "State"}, {"Customer City", "Customer State"})The final output — City and State are expanded out of CustData and renamed to Customer City and Customer State.
CustomerName | Product | Customer City | Customer State | |
|---|---|---|---|---|
| 1 | Alice | Widget A | New York | NY |
| 2 | Bob | Gadget B | Chicago | IL |
| 3 | Charlie | Widget C | Houston | TX |