Table.ReplaceValue

Syntax

Table.ReplaceValue(table as table, oldValue as any, newValue as any, replacer as function, columnsToSearch as list) as table

About

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

Example 1

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

Usage

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

Output

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

Example 2

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

Usage

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

Output

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