Table.ToColumns

Table

Returns a list of lists, where each inner list contains the values of one column.

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

Syntax

Table.ToColumns(table as table) as list

Parameters

NameTypeRequiredDescription
tabletableYesThe table to convert.

Return Value

listA list of lists, one inner list per column, in column order.

Remarks

Table.ToColumns is the inverse of Table.FromColumns. It returns a list of lists — one per column — where each inner list contains all values in that column in row order.

This is useful for transposing data, passing column data to list functions, or zipping columns together.

Examples

Example 1: Extract all column values as lists

let
    Source  = #table({"A", "B"}, {{1, 4}, {2, 5}, {3, 6}}),
    Columns = Table.ToColumns(Source)
in
    Columns
Applied Steps

The final output — converts the table into a list of lists, one inner list per column: the first inner list contains all values from column A and the second from column B.

Result
1{{1,2,3},{4,5,6}}

Example 2: Transpose a table using ToColumns and FromColumns

let
    Source     = #table({"A","B","C"},{{1,2,3},{4,5,6}}),
    Cols       = Table.ToColumns(Source),
    Transposed = Table.FromColumns(Cols)
in
    Transposed
Applied Steps

The final output — reconstructs a table from the column lists using Table.FromColumns, effectively swapping rows and columns so that the original columns become rows.

Column1
Column2
114
225
336

Compatibility

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