Table.ReplaceValue

Table.ReplaceValue

Replaces one value with another in the specified columns.

function (table as table, optional oldValue as nullable any, optional newValue as nullable any, replacer as function, columnsToSearch as list) as table

Description

Replaces oldValue with newValue in the specified columns of the table.

Category

Table.Transformation

Examples

Replace the text "goodbye" with the text "world" in the table.

Table.ReplaceValue(Table.FromRecords({[a = 1, b = "hello"], [a = 3, b = "goodbye"]}), "goodbye", "world", Replacer.ReplaceText, {"b"})

Table.FromRecords({[a = 1, b = "hello"], [a = 3, b = "world"]}, { "a", "b" })

Replace the text "ur" with the text "or" in the table.

Table.ReplaceValue(Table.FromRecords({[a = 1, b = "hello"], [a = 3, b = "wurld"]}), "ur", "or", Replacer.ReplaceText, {"b"})

Table.FromRecords({ [a = 1, b = "hello"], [a = 3, b = "world"]}, { "a", "b" })