---
title: Record.FromTable – Convert a table into a record
url: https://www.thepexcel.com/functions/power-query/record-functions/record-fromtable/
type: function-explainer
program: Power Query
syntax: Record.FromTable(table as table) as record
date: 2025-12-04
updated: 2025-12-17
scores:
  popularity: 5
  difficulty: 4
  usefulness: 5
---

# Record.FromTable – Convert a table into a record

> Convert a table with Name and Value columns into a record | แปลงตารางที่มีคอลัมน์ Name และ Value เป็น Record

## คำอธิบาย

Returns a record from a table containing field names and corresponding values | แปลงตารางที่มีชื่อฟิลด์และค่าเป็น Record

## Syntax

```excel
Record.FromTable(table as table) as record
```

## Arguments

| Name | Required | Type | Default | Description |
| --- | --- | --- | --- | --- |
| table | Yes | table |  | A table containing records with Name and Value columns where each row's Name becomes a field name and Value becomes the field value |

## ตัวอย่าง

### 1. Convert a Name-Value table to a record

```excel
let
    Source = Table.FromRecords({
        [Name = "CustomerID", Value = 1],
        [Name = "Name", Value = "Bob"],
        [Name = "Phone", Value = "123-4567"]
    }),
    Result = Record.FromTable(Source)
in
    Result
```

**ผลลัพธ์:** `[CustomerID = 1, Name = "Bob", Phone = "123-4567"]`

Transforms a structured table into a single record where each row's Name becomes a field and Value becomes the field value

### 2. Transform dynamic Name-Value pairs

```excel
let
    Data = Table.FromRecords({
      [Name = "FirstName", Value = "Alice"],
      [Name = "LastName", Value = "Smith"],
      [Name = "Email", Value = "alice@example.com"]
    }),
    Result = Record.FromTable(Data)
in
    Result
```

**ผลลัพธ์:** `[FirstName = "Alice", LastName = "Smith", Email = "alice@example.com"]`

Build a record dynamically from a table structure, useful for pivoting data from rows to a single record object

### 3. Convert unpivoted data to record format

```excel
let
    Source = Table.FromRecords({[Name = "Jan", Value = 100], [Name = "Feb", Value = 150], [Name = "Mar", Value = 120]}),
    Record = Record.FromTable(Source)
in
    Record
```

**ผลลัพธ์:** `[Jan = 100, Feb = 150, Mar = 120]`

Convert monthly data from a long format table into a record with months as fields

## ฟังก์ชันที่เกี่ยวข้อง

- [Record.ToTable – แปลง Record เป็น Table](https://www.thepexcel.com/functions/power-query/record-functions/record-totable/)
- [Record.ToList – แปลง Record เป็น List ของค่าข้อมูล](https://www.thepexcel.com/functions/power-query/record-functions/record-tolist/)
- [Table.ToRecords – แปลงตารางเป็น List ของ Record](https://www.thepexcel.com/functions/power-query/table-functions/table-torecords/)
- [Table.FromRecords – สร้างตารางจากรายการ Record](https://www.thepexcel.com/functions/power-query/table-functions/table-fromrecords/)

## แหล่งข้อมูลเพิ่มเติม

- [Microsoft Learn: Record.FromTable](https://learn.microsoft.com/en-us/powerquery-m/record-fromtable) _(official)_

---

_Source: [https://www.thepexcel.com/functions/power-query/record-functions/record-fromtable/](https://www.thepexcel.com/functions/power-query/record-functions/record-fromtable/)_
