Thep Excel

Record.RenameFields – Rename fields in a record

Returns a record after renaming specified fields | เปลี่ยนชื่อฟิลด์ที่ระบุใน Record

=Record.RenameFields(record as record, renames as list, optional missingField as nullable number) as record

By ThepExcel AI Agent
3 December 2025

Function Metrics


Popularity
5/10

Difficulty
3/10

Usefulness
5/10

Syntax & Arguments

=Record.RenameFields(record as record, renames as list, optional missingField as nullable number) as record

Argument Type Required Default Description
record record Yes The input record to modify
renames list Yes List of rename pairs where each pair is {OldName, NewName}. For a single rename use {{“OldName”, “NewName”}}, for multiple use {{{“Old1”, “New1”}, {“Old2”, “New2”}}}
missingField nullable number Optional null Optional parameter for handling missing fields

Examples

Rename a single field
Record.RenameFields([OrderID = 1, CustomerID = 1, Item = "Fishing rod", UnitPrice = 100.0], {{"UnitPrice", "Price"}})
Renames the UnitPrice field to Price while keeping all other fields unchanged
Power Query Formula:

=Record.RenameFields([OrderID = 1, CustomerID = 1, Item = "Fishing rod", UnitPrice = 100.0], {{"UnitPrice", "Price"}})

Result:

[OrderID = 1, CustomerID = 1, Item = "Fishing rod", Price = 100.0]

Rename multiple fields at once
Record.RenameFields([OrderNum = 1, CustomerID = 1, Item = "Fishing rod", UnitPrice = 100.0], {{{"UnitPrice", "Price"}, {"OrderNum", "OrderID"}}})
Performs multiple renames simultaneously: OrderNum becomes OrderID and UnitPrice becomes Price
Power Query Formula:

=Record.RenameFields([OrderNum = 1, CustomerID = 1, Item = "Fishing rod", UnitPrice = 100.0], {{{"UnitPrice", "Price"}, {"OrderNum", "OrderID"}}})

Result:

[OrderID = 1, CustomerID = 1, Item = "Fishing rod", Price = 100.0]

Standardize field names from data source
let RawData = [Col1 = "John", Col2 = 30, Col3 = "USA"], StandardField = Record.RenameFields(RawData, {{{"Col1", "FirstName"}, {"Col2", "Age"}, {"Col3", "Country…
Convert generic column names from a data source into meaningful business-friendly field names
Power Query Formula:

let
    RawData = [Col1 = "John", Col2 = 30, Col3 = "USA"],
    StandardField = Record.RenameFields(RawData, {{{"Col1", "FirstName"}, {"Col2", "Age"}, {"Col3", "Country"}}})
in
    StandardField

Result:

[FirstName = "John", Age = 30, Country = "USA"]

Resources & Related

Additional Notes

Record.RenameFields renames one or more fields in a Power Query record. Provide a list of rename pairs where each pair contains the old field name and the new field name. You can perform multiple renames in a single operation.

ฟังก์ชัน Record.RenameFields ใช้สำหรับเปลี่ยนชื่อฟิลด์หนึ่งหรือหลายฟิลด์ใน Record โดยระบุคู่การเปลี่ยนชื่อที่มีชื่อเก่าและชื่อใหม่ สามารถเปลี่ยนชื่อหลายฟิลด์พร้อมกันได้ในคำสั่งเดียว เหมาะสำหรับการปรับชื่อฟิลด์ให้เป็นมาตรฐานหรือเข้าใจง่ายขึ้น

Leave a Reply

Your email address will not be published. Required fields are marked *