Forum Discussion
Convert HTML to Text
Hi
I have a share point list that has comments in HTML. I have used the below formula to convert to plain text in Power Query
Html.Table([ColumnName] , {{"text",":root"}})
however there are rows that have no comments in the sharepoint list and the formula errors saying that the type null can not be converted to text. how do i get around this issue.
thanks
Hi WJ876400
You can deal with this error by usng try ... otherwise like so
try Html.Table([ColumnName] , {{"text",":root"}}) otherwise nullSo if you encounter an error at this point, Power Query will just return null and the query won't stop at this step.
Regards
Phil
7 Replies
- PhilipTreacySuper User
Hi WJ876400
You can deal with this error by usng try ... otherwise like so
try Html.Table([ColumnName] , {{"text",":root"}}) otherwise nullSo if you encounter an error at this point, Power Query will just return null and the query won't stop at this step.
Regards
Phil
- AnonymousNot applicable
- WJ876400Helper IV
Hi Anonymous
Thanks for the response, i have followed the steps but it hasn't worked. I don't get the options in the example on the drop down menu
- AnonymousNot applicable
- v-lionel-msftCommunity Support
Hi WJ876400 ,
Is it like this?
Would you mind providing your HTML code? I hope to test it.
Best regards,
Lionel ChenIf this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
- AnonymousNot applicable
Try this in PQ advance editor - Table.AddColumn(#"Previous column", "New column name", each Html.Table([Html column],{{"PlainText",":root"}})).
- HenkyG0New Member
You can also use a browser-based tool like https://htmltotext.com/ — probably the easiest way to convert HTML to text.