Table.FromColumns
TableConstructs a table from a list of column lists, with optional column names and type information.
Syntax
Table.FromColumns(lists as list, optional columns as any) as tableParameters
| Name | Type | Required | Description |
|---|---|---|---|
lists | list | Yes | A list of lists, one inner list per column. |
columns | any | No | A table type, a list of column names, or a list of {name, type} pairs. |
Return Value
table — A table whose columns are the supplied lists.
Remarks
Table.FromColumns is the column-oriented counterpart to Table.FromRecords. Supply one list per column; all lists must be the same length. Column names can be provided as a second argument — pass a list of strings, a list of {name, type} pairs, or a table type.
If columns is omitted, columns are named Column1, Column2, etc.
Examples
Example 1: Build a table from column lists
Table.FromColumns(
{{1, 2, 3}, {"Alice", "Bob", "Carol"}},
{"ID", "Name"}
)Output
ID | Name | |
|---|---|---|
| 1 | 1 | Alice |
| 2 | 2 | Bob |
| 3 | 3 | Carol |
Example 2: Transpose a table using FromColumns and ToColumns
let
Source = #table({"A","B","C"},{{1,2,3},{4,5,6}}),
Columns = Table.ToColumns(Source),
Transposed = Table.FromColumns(Columns)
in
TransposedCompatibility
✓ Power BI Desktop✓ Power BI Service✓ Excel Desktop✓ Excel Online✓ Dataflows✓ Fabric Notebooks