Forum Discussion
Trying to Find/Replace Based on Another Sheet in Power Query
use this modified version of your code that might work with the Table.TransformColumns approach:
let
Source = Excel.Workbook(File.Contents("C:\Source Documents\AllContentReport.xlsx"), null, true),
AllContentReport_Sheet = Source{[Item="AllContentReport",Kind="Sheet"]}[Data],
ListReplacementsTexts = List.Zip({#"Encoding Reference"[#"From UTF-8"], #"Encoding Reference"[Character]}),
// Ensure headers are promoted if not done already
PromotedHeaders = Table.PromoteHeaders(AllContentReport_Sheet, [PromoteAllScalars=true]),
// Replace UTF-8 characters in LinkURL column
ReplacedUtf = Table.TransformColumns(
PromotedHeaders,
{{"LinkURL", each List.Accumulate(ListReplacementsTexts, _, (current, lists) => Text.Replace(current, lists{0}, lists{1}))}}
)
in
ReplacedUtf
Ensure ListReplacementsTexts is correctly structured with each item as { "encoded_value", "decoded_value" }.
Example: ListReplacementsTexts = { { "%20", " " }, { "%21", "!" }, { "%22", "\"" }, ... }
Also:
Ensure that the LinkURL column is accessible in the query by checking the column names at each step. It appears you initially referenced LinkURL but also tried Column19. Verify that the correct column name is in place after any renaming or transformation steps.
If the headers are not yet promoted, Power Query will not recognize LinkURL as the column name. Add a Promote Headers step before attempting to reference LinkURL