How to Create a Word Document from HTML using Power Automate?

In this Power Automate tutorial, we will see how to create a word document from Html using Power Automate.

For this, we will create a Manual trigger flow and we will create a Word file from HTML using Power Automate. To do this we will use 3rd party action i.e. Populate the Word document from Encodian, which we will use to insert html data to word file.

power automate create word document from html

To use this action from Encodian, we need API Key, you will get this by filling out the form to set up the free trial. When you will add the action to the flow, use the API Key and configure it.

How to create word document from HTML using Power Automate

Here we will see how to create word document from Html using Power Automate Instant cloud flow.

Before we will start creating the flow, you must make sure that you have the API Key. And create the below template word file in SharePoint Library. Which contains the below content.

<<[exampleData]-html>>
Create a Word Document from HTML using Power Automate

Step 1: Login to Power Automate, click on +Create icon -> select Instant Cloud Flow.

How to create word document from html using MS power automate

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

create word document from html using Microsoft power automate flow

Now, you can see the Manually trigger a flow is added to the flow page.

create word document from html Using power automate

Step 2: Next click on the +New step -> select Compose action. Then provide the below information.

  • Inputs: Provide the below HTML code.
<!DOCTYPE html>
<html>
<head>
  <title>HTML to word Example</title>
</head>
<body>
  <h1>HTML to word Example</h1>
  <p>This is a sample HTML file to test the conversion to word using Power Automate Encodian</p>
  <ul>
    <li>Get file content of Template word docx</li>
    <li>Populate the Html content in word</li>
    <li>Create a Final word file.</li>
  </ul>
</body>
</html>
Microsoft power automate create word document from html

Step 3: Now we get file content from Template word document, so click on the +New step -> select Get file content action. Then provide the below information:

  • Site address: Select or Provide the SharePoint site address.
  • File Identifier: Provide the file path.
create word document from html using Microsoft power automate

Step 4: Next we will insert Html data in Word file, so, click on the +New step -> select Populate Word document action from Encodian. Then provide the below information:

  • File content: Select output from dynamic content.
  • Document data: Provide the below data.
{
"exampleData":"@{outputs('Compose')}"
}
How to create word document from html using Microsoft power automate

Step 5: Now we will create a final word file, so, click on the +New step -> select Create File action.

Then provide the below information:

  • Site address: Select or provide SharePoint site address
  • Folder path:Provide the folder path
  • File name: Provide the file name
  • File content: Provide the file content from dynamic content.
How to create word document from html using power automate

Step 6: To test the flow click on Test icon, click on the Test icon-> select Manually -> click on Test -> configure the action with connectors, then click on Run flow -> Then click on Done.

Now you can see your flow ran successfully. You can see a new file created in the SharePoint folder contains the content like below.

Create a Word Document from HTML using Power Automate

Conclusion

In this Power Automate tutorial, we saw how to create a word file from HTML using Power Automate.

You may also like:

>