Power Query
Search…
Record.RenameFields

Record.RenameFields

Applies rename(s) from a list in the form { old, new }.
function (record as record, renames as list, optional missingField as nullable any) as record

Description

Returns a record after renaming fields in the input record to the new field names specified in list renames. For multiple renames, a nested list can be used ({ {old1, new1}, {old2, new2} }.

Category

Record.Transformations

Examples

Rename the field "UnitPrice" to "Price" from the record.
1
Record.RenameFields([OrderID = 1, CustomerID = 1, Item = "Fishing rod", UnitPrice = 100.0], {"UnitPrice","Price"})
Copied!
[OrderID = 1, CustomerID = 1, Item = "Fishing rod", Price = 100.0]
Rename the fields "UnitPrice" to "Price" and "OrderNum" to "OrderID" from the record.
1
Record.RenameFields([OrderNum = 1, CustomerID = 1, Item = "Fishing rod", UnitPrice = 100.0], { {"UnitPrice", "Price"}, {"OrderNum", "OrderID"} })
Copied!
[OrderID = 1, CustomerID = 1, Item = "Fishing rod", Price = 100.0]