Table.FromValue
TableWraps a scalar value, list, or record into a table.
Syntax
Table.FromValue(value as any, optional options as nullable record) as tableParameters
| Name | Type | Required | Description |
|---|---|---|---|
value | any | Yes | The value to wrap. May be a scalar, list, or record. |
options | record | No | Optional record. Supports field DefaultColumnName (text) to override the default column name "Value". |
Return Value
table — A single-column table (or multi-column for records) containing the provided value.
Remarks
Table.FromValue is a general-purpose wrapper that converts almost any M value into a table. The output structure depends on the input type:
- Scalar (number, text, date, logical, etc.): produces a single-row, single-column table named Value.
- List: produces a single-column table with one row per list element, column named Value.
- Record: produces a two-column table (Name and Value) with one row per field.
- Table: returns the table unchanged.
Use the options record's DefaultColumnName field to rename the default Value column to something more descriptive. Table.FromValue is useful in dynamic scenarios where the input type is unknown at authoring time — it provides a uniform table interface regardless of what value is passed in.
For converting a list to a single-column table with a known name, Table.FromList or Table.FromValue({...}, [DefaultColumnName = "MyCol"]) are both valid. For records, Table.FromValue generates a vertical key-value layout (useful for serialization or display), which differs from Table.FromRecords (which expects a list of records and produces a row per record).
Examples
Example 1: Wrap a scalar number into a table
Table.FromValue(42, [DefaultColumnName = "OrderCount"])OrderCount | |
|---|---|
| 1 | 42 |
Example 2: Convert a list of product prices into a table
let
Prices = {25.00, 50.00, 15.00, 75.00, 120.00}
in
Table.FromValue(Prices, [DefaultColumnName = "Price"])Price | |
|---|---|
| 1 | 25 |
| 2 | 50 |
| 3 | 15 |
| 4 | 75 |
| 5 | 120 |
Example 3: Convert a record into a key-value table
let
Config = [StartDate = "2024-01-01", EndDate = "2024-12-31", MaxRows = 1000]
in
Table.FromValue(Config)Name | Value | |
|---|---|---|
| 1 | StartDate | 2024-01-01 |
| 2 | EndDate | 2024-12-31 |
| 3 | MaxRows | 1000 |