let HtmlToText = (data as table, HtmlFieldName as text, NewTextFieldName as text) => let // Create a new column with the given name and type text #"Duplicated Column" = Table.DuplicateColumn(data, HtmlFieldName , NewTextFieldName ), #"Changed Type" = Table.TransformColumnTypes(#"Duplicated Column",), // pretty-print HTML as plain text #"Replaced Value1" = Table.ReplaceValue(#"Changed Type","|","&pipe;",Replacer.ReplaceText,{NewTextFieldName}), #"Replaced Value2" = Table.ReplaceValue(#"Replaced Value1","
","#(cr)#(lf)",Replacer.ReplaceText,{NewTextFieldName}), #"Replaced Value3" = Table.ReplaceValue(#"Replaced Value2","
","#(cr)#(lf)",Replacer.ReplaceText,{NewTextFieldName}), #"Replaced Value4" = Table.ReplaceValue(#"Replaced Value3","","#(cr)#(lf)",Replacer.ReplaceText,{NewTextFieldName}), #"Replaced Value6" = Table.ReplaceValue(#"Replaced Value5","","#(cr)#(lf)",Replacer.ReplaceText,{NewTextFieldName}), #"Replaced Value7" = Table.ReplaceValue(#"Replaced Value6","<","|",Replacer.ReplaceText,{NewTextFieldName}), #"Mod Column" = Table.TransformColumns(#"Replaced Value8",), // Replace common entity references with their representing characters #"Expanded Text" = Table.ExpandListColumn(#"Mod Column", NewTextFieldName), #"Trimmed Text" = Table.TransformColumns(#"Expanded Text",), #"Replaced Value9" = Table.ReplaceValue(#"Trimmed Text",""","""",Replacer.ReplaceText,{NewTextFieldName}), #"Replaced Value10" = Table.ReplaceValue(#"Replaced Value9","&","&",Replacer.ReplaceText,{NewTextFieldName}), #"Replaced Value11" = Table.ReplaceValue(#"Replaced Value10","<","<",Replacer.ReplaceText,{NewTextFieldName}), #"Replaced Value12" = Table.ReplaceValue(#"Replaced Value11",">",">",Replacer.ReplaceText,{NewTextFieldName}), #"Replaced Value13" = Table.ReplaceValue(#"Replaced Value12", "&pipe;","|",Replacer.ReplaceText,{NewTextFieldName}), Result = #"Replaced Value13" in Result in HtmlToText