How to Convert HTML to Word DOCX in Power Automate

Cloudmersive
4 min readJan 27, 2025

--

Open Office XML files like MS Word DOCX are structured using XML markup. Given HTML and XML are related markup languages, making high-fidelity conversions between HTML and DOCX is relatively straightforward.

All we need is a method that can handle the format translation on our behalf — or, in the case of a no-code Power Automate flow, all we need is a single connector action.

Convert HTML to DOCX in Power Automate

In Power Automate, we can easily convert HTML to DOCX using the Cloudmersive Document Conversion connector. The Convert HTML to Word DOCX Document action takes HTML content as an argument and returns DOCX file bytes — simple as that.

To see this in action, we can build a quick Instant cloud flow in Power Automate. This is the ideal way to test 3rd party APIs & built-in connector actions alike.

Bring HTML file content into the flow

We’ll start by retrieving HTML file content from our file system. In this example, we’ll retrieve multiple HTML files from a single SharePoint folder and convert each of them to DOCX in a single flow.

To handle that, we’ll use the List folder action to return file identifiers from our HTML folder, and we’ll subsequently use the file identifiers in a Get file content action.

Once we select the Id (file identifier) value in our Get file content action, Power Automate will wrap our Get file content action in a For each control (as shown above).

Convert HTML to DOCX with Cloudmersive

To convert each of our HTML files to DOCX, we’ll add our HTML to DOCX conversion action within the For each control.

We’ll start by searching for Cloudmersive connectors in the Power Automate connector library & locating the Document Conversion connector with the green logo.

After we click “See more” to view the actions list, we’ll CTRL+F search for the Convert HTML to Word DOCX Document action.

Create a Cloudmersive Document Conversion connection

Upon selecting this action, we’ll encounter a window asking us to create our Cloudmersive Document Conversion connection. All we need is a free Cloudmersive API key to authorize our connection — and we can get one by creating a free account on the Cloudmersive website.

Configure the HTML to DOCX request

To configure our HTML to DOCX request, we’ll click “Show all” to view the advanced parameters, and we’ll then pass File Content from our Get file content action as an argument in the InputRequest/Html field.

Create the new DOCX files in SharePoint

At this point, we’ve converted all our HTML files to DOCX format. We can now write those files to a SharePoint folder with .docx extensions using a Create file action from the SharePoint connector (we can also use the DisplayName value from our List folder action to dynamically give each DOCX file the same name as the original HTML file — only without the .html extension).

Run the flow

We’ll now save and test our flow so we can see the result of our conversion.

In this example, we’ll find three new DOCX files in our folder (alongside the original HTML files for reference).

We should find that the text in our HTML to DOCX conversion was handled with high fidelity, and background formatting was ignored (as shown in the below example).

Conclusion

In this article, we learned how to easily convert HTML files to MS Word DOCX format in a simple Power Automate flow. We converted multiple HTML files from a SharePoint folder to DOCX and stored the result in the same folder to compare the input & ouput content.

Don’t forget to follow this blog for more quick & easy Power Automate walkthroughs!

--

--

Cloudmersive
Cloudmersive

Written by Cloudmersive

There’s an API for that. Cloudmersive is a leader in Highly Scalable Cloud APIs.

No responses yet