Power Automate Tutorial: Streamline Document Creation Effortlessly

Fast Track Document Creation Through Automation

For many organizations, filling out standard document templates can take up a lot of time for people. Copying information from different systems into a Word document is a manual process for many. Along with being time consuming, this manual data copy can be prone to error.

One of the things I love about Power Automate in Microsoft 365, is how flexible it is to help with these manual processes. For example, did you know Power Automate can do a lot of the work for you with filling out document templates?

In this article I go through how you can use Power Automate to pupulate your document templates and remove the manual effort from these repetitive tasks.

Note: The steps involved in this article use the Premium Connector “Populate a Microsoft Word template” which requires a Power Automate Premium License.

Example Requirements

For the purposes of this article, I will base the solution on the following requirements:

  • Our organization has a process for requesting new laptops for staff. This process requires a Word document template to be filled out.
  • The document must be printed and signed by a member of management
  • A SharePoint list is also used to track requests so should be populated with the request details.

This is a basic example and in most organizations I would recommend they move to Power Automate approvals, but it’s a good example of how we can populate document templates.

Document Templates in Word

Before we start, we need to make our Word document into a template that Power Automate can use. If we take a sample Word document as shown in Figure 1, let’s look at how we can update this to add in placeholders where we need them.

Figure 1: A basic Word form for a new laptop request

Each of the areas in the form that we want PowerAutomate to populate needs to be converted to a content control. This is done using the Word developer menu. If you don’t see the developer menu in your Word ribbon, open the Microsoft Word options page, and from the “Customize Ribbon” section, add the Developer item to the ribbon by checking the box (Figure 2).

Figure 2: Add the Developer options to the ribbon

With the Developer options available on our ribbon, we now highlight the text we want Power Automate to update for us, and select the “Plain Text Content Control” option from the developer menu as shown in Figure 3.

Figure 3: Select the text you want to update and choose “Plain Text Content Control”

We also want to select the “Properties” option from the developer menu and give our control a name so we can recognize it in Power Automate (Figure 4).

Figure 4: Give the control a title and tag name.

Once we’ve updated each area we want to update from PowerAutomate, our document is ready. Save it for now and we will move on to preparing our SharePoint environment.

Prepare SharePoint Online

I mentioned in the requirement section we have a SharePoint list that manages requests. This list (shown in Figure 5) contains the following columns:

  • Title: The title of the request (A plain text field)
  • Requestor: The person making the request (A People field)
  • Required for: The person who needs the laptop (A People field)
  • Replacement: A choice asking if the laptop is a replacement (A Choice filed)
  • Replacement Asset ID: If the laptop is a replacement, what’s the asset ID of the previous device (A plain text field)
  • Justification: The justification for the new laptop requirement (A plain text field)
Figure 5: The SharePoint list that manages requests

In our SharePoint site, we also upload our Word template to the document library in the site. This allows it to be accessed from Power Automate.

Finally, we create a form for the SharePoint list so users can send in their requests (Figure 6).

Figure 6: A form allows users to add requests to the SharePoint list

Create The Automation Flow

From Power Automate, we create a new, blank flow using the “When an item is created” trigger for SharePoint (Figure 7).

Figure 7: Create a new blank flow that triggers when an item is created

Within the flow, we need to add a few things. First, modify the trigger to start when a new item is added to our SharePoint list (Figure 8).

Figure 8: The trigger starts when an item is added to our SharePoint list

The next step is to get our Word document Template from our document library and populate it based on our new request. To do this, add the “Populate a Microsoft Word Template” action. Configure the action to select the document template we uploaded earlier and using the values from the previous step, populate the advanced parameters (Figure 9).

Figure 9: Populate the action parameters with the response from the trigger

In this example I have taken most of the parameters from the trigger action and the current date using the utcNow() expression.

The next step we take is to create the output file. To do this, add the SharePoint “Create file” action as the next step in the flow. In the “Create file” action, select the site and folder you want to store the output file in, give it a title (I’ve taken this from the request) and take the Word content from the previous step as the file content (Figure 10).

Figure 10: Using the SharePoint “Create file” action

We could add extra steps such as converting the document to PDF, sharing a link to the file or emailing it out but for the purposes of this example, I’ll leave these steps out. When you’re done, the flow should look similar to the simple example in Figure 11, make sure to save it and then move on to testing.

Figure 11: The basic steps of this flow

Testing The Flow

To test the flow, click the “test” button and select a manual trigger. Now have a user fill out the form. In my example in Figure 12, a user in the organization who does not have access to the SharePoint site or list, fills in the form.

Figure 12: Populate the form to start the flow

On the flow test page, we can track the flow through and see it completes successfully (Figure 12).

Figure 13: The flow completes successfully

Checking in the SharePoint document library we specified earlier, the file is created with the information from the form / list (Figure 14).

Figure 14: The file is created with the information from the form

Summary

While the steps here require premium licensing for Power Automate, the time that can be saved on manual processes is massive. PowerAutomate is fantastic for these process optimization tasks and can really make up the value very quickly if you take the time to update your processes.

This example is a pretty straightforward one and as I mentioned previously, I would probably recommend that this uses cloud-based approvals rather than creating Word documents but the idea of creating documents automatically from pre-existing data is a major time-saver!

Leave a comment