Twitter/Facebook

Pinterest
Monday, April 6, 2020

New source->New blank query-> Highlight the fx (to convert it into function)
Function 1 to remove all HTML Tags
(txt as text) =>
[
fnRemoveFirstTag = (HTML as text)=>

let
TextBetween=Text.BetweenDelimiters(HTML,"<",">"),
Output=if Text.Length(TextBetween)>0 then

Text.Replace(HTML,
Text.Insert(
Text.Insert(TextBetween,0,"<"),
Text.Length(TextBetween)+1,">")
,"")
else
HTML
in
Output,
fnRemoveHTMLTags = (y as text)=>
if y<>null then
if fnRemoveFirstTag(y)<>y then
@fnRemoveHTMLTags(fnRemoveFirstTag(y))
else
y
else "",
Output =if txt <> null then @fnRemoveHTMLTags(txt) else ""
][Output]


Function 2 to remove encodings
let
Source = (txt as text) =>
[
fnRemovecodes = (y as text)=>
Text.Replace(Text.Replace(
Text.Replace(Text.Replace(Text.Replace(
Text.Replace(Text.Replace(
Text.Replace(Text.Replace(
Text.Replace(Text.Replace(
Text.Replace(
Text.Replace(y,"'","'"),
"<","<"),
">",">"),
""",""""),
"&","&"),
" "," "),
"©","©"),
"®","®"),
"¢","¢"),
"£","£"),
"¥","¥"),
"€","€"),"'","'"),

Output =if txt <> null then @fnRemovecodes(txt) else ""
][Output]
in
Source

To apply to the column of your table
- Go to the table, clock on the column
- click on Add column-> Invoke custom function
Give  aname to new column. Select the function1 and for txt select the column that you need to convert from HTML to text. Then on the new column select function 2 and for txt select the new column from previous step.




0 Scribbles:

Post a Comment

Thank You for taking pains, commenting :)

LinkWithin

Search This Blog

 
badge