How to Convert HTML Strings to Plain Text in Power Automate
Converting an HTML string to text means removing plain, unformatted text content from HTML tags.
Doing so gives us the option to efficiently use and/or analyze text content from any web page without needing to worry about its original styling or dynamic elements getting in the way.
In Power Automate, we can easily convert HTML to text without writing a line of code, and we can use that text for myriad purposes in downstream flow actions.
In this article, we’ll learn how to convert HTML documents to plain text using the Cloudmersive Document Conversion connector. I’ll be converting an example Lorem Ipsum web page in my flow.
Walkthrough
We’ll start by creating an instant cloud flow with a manual trigger.
We’ll now use a Get file content action to retrieve an HTML file from our file system. I’ll be grabbing my file from a OneDrive for Business folder.
Next, we’ll add a new action and search for Cloudmersive connectors. This will bring up a few Cloudmersive connector options; we’re looking for the Document Conversion connector with the green logo.
We’ll now click “See more” to view the actions list, and from there, we’ll search for an action called Convert HTML string to text (txt).
After we select this action, we’ll need to create our Cloudmersive connection and authorize it with an API key. We can get a free API key (this allows up to 800 API calls per month with zero commitments in perpetuity) by creating a free account on the Cloudmersive website.
When we’re ready to configure our HTML to text conversion, we’ll click “Show all” to view the advanced parameters and enter our HTML file content in the Input/Html parameter.
Now we’ll save and test our flow.
When we open our Convert HTML string to text (txt) action, we’ll find a “TextContentResult” response containing our text string.
No need to worry about dealing with HTML formatting anymore — we can easily use this response content in a wide range of subsequent flow actions, and we can clean or parse this text using Power Automate’s string functions.