Table.FromColumns

Syntax

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

About

Creates a table of type columns from a list lists containing nested lists with the column names and values. If some columns have more values then others, the missing values will be filled with the default value, 'null', if the columns are nullable.

Example 1

Return a table from a list of customer names in a list. Each value in the customer list item becomes a row value, and each list becomes a column.

Table.FromColumns({ {1, "Bob", "123-4567"} , {2, "Jim", "987-6543"}, {3, "Paul", "543-7890"} })
Column1 Column2 Column3
1 2 3
Bob Jim Paul
123-4567 987-6543 543-7890

Example 2

Create a table from a given list of columns and a list of column names.

Table.FromColumns({ {1, "Bob", "123-4567"} , {2, "Jim", "987-6543"}, {3, "Paul", "543-7890"}}, {"CustomerID", "Name", "Phone"})
CustomerID Name Phone
1 2 3
Bob Jim Paul
123-4567 987-6543 543-7890

Example 3

Create a table with different number of columns per row. The missing row value is null.

Table.FromColumns({ {1, 2, 3}, {4, 5}, {6, 7, 8, 9} }, {"column1", "column2", "column3"})
column1 column2 column3
1 4 6
2 5 7
3 8
9