Table.FromColumns

Table

Constructs a table from a list of column lists, with optional column names and type information.

Examples on this page use shared sample tables. View them to understand the input data before reading the examples below.

Syntax

Table.FromColumns(lists as list, optional columns as any) as table

Parameters

NameTypeRequiredDescription
listslistYesA list of lists, one inner list per column.
columnsanyNoA table type, a list of column names, or a list of {name, type} pairs.

Return Value

tableA 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
11Alice
22Bob
33Carol

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
    Transposed

Compatibility

Power BI Desktop Power BI Service Excel Desktop Excel Online Dataflows Fabric Notebooks
Contributors
kyleamueller