<!-- https://learnsql.cpetoday.com/functions/m/record-fromtable -->
# Record.FromTable

Language: Power Query M
Category: Record
Syntax: Record.FromTable(table)
Summary: Builds a record from a table with a Name column and a Value column.
Returns: A record with one field for each row of the table.
Level: Intermediate
Related: Record.ToTable, Record.Combine, Record.Field, Record.FieldNames, Table.FromRecords

## What it does
Record.FromTable is the reverse of Record.ToTable. Each row of the table becomes one field of the record: the value in the Name column becomes the field name and the value in the Value column becomes its value. Use it when settings or mappings are kept in a small table, and a query needs to look them up by name.

## Syntax and arguments
- `table`: a table with exactly the two columns Name and Value. Names must be unique.

## Example
A settings table holds the parameters for a month-end query: the period, the entity and the approval limit. The query reads them by name.

```powerquery
let
    Settings = #table(
        {"Name", "Value"},
        {{"Period", "2026-03"}, {"Entity", "Northwind US"}, {"ApprovalLimit", 5000}}
    ),
    Config = Record.FromTable(Settings),
    Limit = Config[ApprovalLimit]
in
    Limit
```

`Config` is a record with three fields, and `Limit` is 5000. The query uses the names rather than the row numbers, so adding a setting later does not break the lookups.

## Example: a second, different use
Turning a two-column mapping table into a lookup record, so that a code can be translated with `Mapping[code]`.

## Things to watch
- Names must be unique. A duplicate name gives an error.
- The names must be text. A numeric name is not allowed as a field name.
- Values can be any type. Keep the types consistent for the settings you use.
- A missing field is an error when you read it, so check with Record.HasFields if the setting is optional.

## In business terms
Keeping parameters, mappings and tolerances in a small visible table is good control practice, because a reviewer can read and change them without editing code. Record.FromTable lets the query use that table as named settings.
