Table.FromColumns

Generates a table with columns of a specified type using a list of nested lists that include column names and values. In cases where columns have differing numbers of values, any missing values will b...

Syntax

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

About

Generates a table with columns of a specified type using a list of nested lists that include column names and values. In cases where columns have differing numbers of values, any missing values will be populated with the default value, 'null', if the columns are able to accept null values.

Explanation

Example 1: Take a list of customer names and convert it into a table structure. Each customer's name in the list will be represented as a row value, and each list will be like a column in the table. Usage: Power Query MTable.FromColumns({ {1, "Bob", "123-4567"}, {2, "Jim", "987-6543"}, {3, "Paul", "543-7890"} }) Output: Table.FromRecords({ [Column1 = 1, Column2 = 2, Column3 = 3], [Column1 = "Bob", Column2 = "Jim", Column3 = "Paul"], [Column1 = "123-4567", Column2 = "987-6543", Column3 = "543-7890"] }) Example 2: Generate a table from a specified list of columns along with their corresponding column names. Usage: Power Query MTable.FromColumns( { {1, "Bob", "123-4567"}, {2, "Jim", "987-6543"}, {3, "Paul", "543-7890"} }, {"CustomerID", "Name", "Phone"} ) Output: Table.FromRecords({ [CustomerID = 1, Name = 2, Phone = 3], [CustomerID = "Bob", Name = "Jim", Phone = "Paul"], [CustomerID = "123-4567", Name = "987-6543", Phone = "543-7890"]