Thep Excel

Record.RenameFieldsRename fields in a record

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

fx
=Record.RenameFields(record, renames, [missingField]) as record

ความนิยม5/10
ความยาก3/10
ประโยชน์5/10

อัปเดต 3 December 2025

Syntax & Arguments

อาร์กิวเมนต์ ชนิด ค่าเริ่มต้น คำอธิบาย
record record The input record to modify
renames list 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 null Optional parameter for handling missing fields

[ ] = อาร์กิวเมนต์ที่ไม่บังคับ

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 โดยระบุคู่การเปลี่ยนชื่อที่มีชื่อเก่าและชื่อใหม่ สามารถเปลี่ยนชื่อหลายฟิลด์พร้อมกันได้ในคำสั่งเดียว เหมาะสำหรับการปรับชื่อฟิลด์ให้เป็นมาตรฐานหรือเข้าใจง่ายขึ้น

Examples

Rename a single fieldRecord.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

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

ผลลัพธ์[OrderID = 1, CustomerID = 1, Item = "Fishing rod", Price = 100.0]
Rename multiple fields at onceRecord.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

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

ผลลัพธ์[OrderID = 1, CustomerID = 1, Item = "Fishing rod", Price = 100.0]
Standardize field names from data sourcelet 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

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

ผลลัพธ์[FirstName = "John", Age = 30, Country = "USA"]

Resources & Related

ฟังก์ชันที่ผู้เขียนโยงไว้กับ Record.RenameFields จัดกลุ่มตามหมวด · ชี้ที่ชื่อใดชื่อหนึ่ง แล้วฟังก์ชันที่ใช้คู่กันจะมีจุดทอง

ฟังก์ชันนี้Record.RenameFieldsRecord functions
Record functions (3)
Record.RemoveFields

Removes specified fields from a record | ลบฟิลด์ที่ระบุออกจาก Record

Record.SelectFields

Record.SelectFields จะคืนค่า Record ใหม่ที่มีเฉพาะ Field ที่ระบุใน List เท่านั้น สามารถจัดการกับ Field ที่หายไปได้ด้วย option missingField

Record.TransformFields

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

Comments

อีเมลของคุณจะไม่ถูกเผยแพร่