Table.FromRows

Generates a table by organizing the rows list into inner lists, with each inner list representing the column values of a single row. It is possible to specify column names, the table type, or the numb...

Syntax

Table.FromRows(rows as list, optional columns as any) as table

About

Generates a table by organizing the rows list into inner lists, with each inner list representing the column values of a single row. It is possible to specify column names, the table type, or the number of columns as optional parameters.

Explanation

Example 1: Generate a table containing columns [CustomerID] with values {1, 2}, column [Name] with values {"Bob", "Jim"}, and column [Phone] with values {"123-4567", "987-6543"}. Usage: Use Power Query M function Table.FromRows to input data and define column names. Output: Use Table.FromRecords to display the table with the specified columns and values. Example 2: Create a table with columns [CustomerID] having values {1, 2}, [Name] with values {"Bob", "Jim"}, and [Phone] with values {"123-4567", "987-6543"}. The column [CustomerID] should be of number type, while columns [Name] and [Phone] should be of text type. Usage: Utilize Power Query M function Table.FromRows to input data and define column types. Output: Use Table.FromRecords to generate the table with the specified columns and values, ensuring the correct data types for each column.