#table

Generates a table structure by extracting values from designated columns and rows. The columns can consist of a set of column names, a table data type, a specified number of columns, or a null value. ...

Syntax

#table(columns as any, rows as any) as any

About

Generates a table structure by extracting values from designated columns and rows. The columns can consist of a set of column names, a table data type, a specified number of columns, or a null value. The rows are represented as a series of lists, with each list containing the values for each corresponding column in a single row.

Explanation

Example 1 To start, you can create an empty table using Power Query M. Usage Power Query M #table({}, {}) Output #table({}, {}) Example 2 Next, you can create a table by automatically determining the number of columns from the first row of data. Usage Power Query M #table(null, {{"Betty", 90.3}, {"Carl", 89.5}}) Output #table({"Column1", "Column2"}, {{"Betty", 90.3}, {"Carl", 89.5}}) Example 3 Alternatively, you can create a table by specifying the exact number of columns. Usage Power Query M #table(2, {{"Betty", 90.3}, {"Carl", 89.5}}) Output #table({"Column1", "Column2"}, {{"Betty", 90.3}, {"Carl", 89.5}}) Example 4 You can also create a table by providing a list of column names. Usage Power Query M #table({"Name", "Score"}, {{"Betty", 90.3}, {"Carl", 89.5}}) Output #table({"Name", "Score"}, {{"Betty", 90.3}, {"Carl", 89.5}}) Example 5 Finally, you can create a table with a specified data type for each column. Usage Power Query M #table(type table [Name = text, Score = number], {{"Betty", 90.3}, {"Carl