In this Power Automate tutorial, we will see how to convert HTML to text using the Power Automate flow. Also, we will see how to remove line breaks from text after converting from HTML in Power Automate.
For example, we will create a flow that will convert HTML to text using Power Automate, like the one below.
For this, we will create an Instant cloud flow that will take a user input as html file. Then we will convert the HTML file content to text. After that, we will send the text as a file in an email to the recipient using Power Automate.
How to convert html to text using Power Automate
Here we will see how we can convert html to text using Power Automate.
Before creating a flow, create an HTML file like the above and then follow the steps below.
Step 1: Log in to Power Automate and click +Create from the navigation bar-> select Instant Cloud flow.
Then provide the flow name and select Manually trigger a flow action. Then click on Create.
Now you can see Manually trigger flow action is added to the flow page. Now expand the action -> click on Add an input ->select File inputs.
Step 2: Next, we will add the file content to compose, so click on the +New step -> select Compose action. Then provide the below information
- Inputs: Select the File content from the dynamic content
Step 3: Now we will convert html to text, so click on the +New step -> select html to text action. Then provide the below information:
- Content: Select the outputs from dynamic content.
Step 4: Now we will send an email with the text file, so click on the +New step -> select ‘Send an email’ (V2) action. Then provide the below information:
- To: Provide the recipient’s email.
- Subject: Provide the subject of an email
- Body: Provide the body of an email.
Then click on Show Advanced options.
- Attachment name: Provide the file name
- Attachment content: provide the file content from dynamic content.
Step 5: Now run the flow manually; for this, save the flow, click on the Test icon -> select the Manually option, -> click on the Test button. Then click Import and select the HTML file -> click on Run flow. You can see your flow run successfully.
In the Outlook inbox, you can see the mail contains the text file -> click on the dropdown -> select preview; it will look like below.
This is how to convert HTML to Text using Power Automate.
Power Automate html to text and remove line breaks
Here we will see how we can remove line breaks after converting HTML to text.
For example, we will take the below HTML code, and when we convert HTML to text as it comes in a separate line because we have provided <br> line break. So we need to remove the line break with the replace(), then it will look like below.
Now, let’s create a flow in Power Automate.
Step 1: In this Power Automate, click on +Create in the left navigation -> select Instant Cloud flow.
Then provide the flow name and select the Manually trigger a flow action. Then click on Create button.
You can see Manually trigger a flow action is added to the flow page.
Step 2: Next, we will create a compose action to provide the HTML code, so click on the +New step -> select Compose action. Then provide the below information:
- Inputs: Provide the below HTML code.
Step 3: Next, click the +New step -> select Compose action. Then provide the below information.
- Inputs: Click on enter, so the cursor will go to the next line.
Step 4: Now, we will convert HTML to text using Power Automate. So, click on the +New step -> select Html to text action. Then provide the below information:
- Content: Select the output from dynamic content.
Step 5: Now we will replace the line break with ”, so click on the +New step -> select Compose action. Then provide the below information:
- Inputs: Provide the below expression:
replace(outputs('Html_to_text')?['body'],outputs('Line_break') ,'')
Step 6: Next, to show the output for this, we will send an email, so click on the +New step -> select Send an email (V2) action. Then provide the below information:
- To: Provide the email for recipients
- Subject: Provide the subject of an email
- Body: Provide the output of an email
Step 6: Now run the flow manually; for this, save the flow, click on the Test icon -> select the Manually option, -> click on the Test button. You can see your flow run successfully.
Conclusion
In this Power Automate tutorial, we saw how to convert HTML to text using Power Automate. Also, we saw how we can remove line breaks from text in Power Automate.
You may also like:
- Create XML file from CSV in Power Automate
- How to count rows in a SharePoint list using Power Automate?
- How to Check if a field exists in Power Automate?
- How to merge arrays in Power Automate?
- How to convert string to Date using Power Automate?
- How to find text in a string using Power Automate?
- How to delete all rows in Excel using Power Automate?
After working for more than 15 years in Microsoft technologies like SharePoint, Office 365, and Power Platform (Power Apps, Power Automate, and Power BI), I thought will share my SharePoint expertise knowledge with the world. Our audiences are from the United States, Canada, the United Kingdom, Australia, New Zealand, etc. For my expertise knowledge and SharePoint tutorials, Microsoft has been awarded a Microsoft SharePoint MVP (9 times). I have also worked in companies like HP, TCS, KPIT, etc.