How to Convert HTML to Text using Power Automate?

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.

Power automate HTML to text

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.

power automate html to text

Then provide the flow name and select Manually trigger a flow action. Then click on Create.

power automate convert html to text

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.

Using Microsoft power automate convert html to text

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
Using MS power automate convert html to text

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.
Convert HTML to Text using Power Automate

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.
Convert HTML to Text using Power Automate

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.

Convert HTML to Text using Power Automate

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.

Power Automate html to text and remove line breaks

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.

Power Automate html to text and remove line breaks

Then provide the flow name and select the Manually trigger a flow action. Then click on Create button.

power automate convert html to text

You can see Manually trigger a flow action is added to the flow page.

power automate convert html to text remove line break

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.
power automate html to text remove line break

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.
Microsoft power automate html to text remove line break

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.
Microsoft power automate convert  html to text remove line break

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') ,'')
power automate convert  html to text remove 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
Using power automate convert  html to text remove line break

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.

Using power automate html to text remove line break

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:

>