How to Create a Word Document in Power Automate

Cloudmersive
4 min readOct 8, 2024

--

If you’re in the weeds building Power Automate flows daily, you’re probably comfortable automating workflows involving Word documents. The ability to retrieve, rename, combine, share, and transfer DOCX files without code is one of the many advantages Power Automate offers.

Did you know you can actually create DOCX files in Power Automate, though?

Using the Cloudmersive Document Conversion connector in Power Automate, you can generate completely new Word documents from scratch in the middle of your flow. After creating your document, you can enter some initial text to appear at the top of your first page, and you can even string together additional MS Word-focused actions to dynamically generate complex DOCX files on the fly.

Walkthrough

We’ll now walk through a quick example flow that demonstrates this process. We’ll use a manually triggered instant cloud flow for that purpose.

Create a manually triggered instant cloud flow

We’ll start by adding a new action and typing “Cloudmersive” into the connector search bar. This brings up a list of Cloudmersive connectors, and we’re looking for the Cloudmersive Document Conversion connector with the green logo.

Locate the Cloudmersive Document Conversion connector

After we click “See more”, we’ll look for an action called Create a blank Word DOCX document, and we’ll select it once we find it.

Locate the Create a blank Word DOCX document action

Before we proceed with configuring our request, we’ll first need to create our connection. To do that, we’ll need a Cloudmersive API key, and we can get one for free by creating a free account on the Cloudmersive website (this allows a limit of 800 API calls per month with zero commitments).

After we create our connection, we’ll click “Show all” to view our sole request parameter. The InitialText parameter expects a string value from our flow, and it’ll show that string at the top of our new document. In my example, I’ll write “Hello world”.

Add initial text to your new Word document via InitalText parameter

The output from this action is a temporary editing URL designed to be used for in-memory document edits in subsequent Cloudmersive flow actions.

For example, we could pass this URL to another Cloudmersive Document Conversion action for DOCX files — Insert a new paragraph into a Word DOCX document — and add one additional paragraph below our initial text string. This action offers a variety of customization options for our new paragraph; I’ll be adding a simple text content run in this example.

Pass DOCX temporary URL to a subsequent action, e.g. Insert a new paragraph into a Word DOCX document

To return DOCX file bytes to our flow and generate our new Word document, we’ll add one final Cloudmersive Document Conversion connector action. This action is called Finish editing document and download result from document editing.

This time, we’ll use the temporary editing URL generated by our Insert paragraph action.

Pass Insert a new paragraph URL to Finish editing document action

We’ll now create our new Word document using the DOCX file bytes we downloaded from our Finish editing document action.

Create file using downloaded DOCX file bytes from Finish editing document action

After save and test our flow, we’ll find our new DOCX file in the folder we specified.

Save and test your flow
Locate the new DOCX file in the target folder
Review the new DOCX file contents match the InitialText and Insert Paragraph content

All done! Now we can easily create complex Word documents from scratch in Power Automate.

--

--

Cloudmersive
Cloudmersive

Written by Cloudmersive

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

No responses yet