for Microsoft Power Automate and Azure logic apps

Populate a Word or PDF Document using Power Automate

By Jay Goodison

15th May 2020

Populate a Word or PDF Document using Power Automate

A common use case for Power Automate is to create new Word documents populating them with data upon creation.

The Microsoft Word Online (Business) premium connector allows you to do exactly this! You can create a word template which contains controls which the connector can use to dynamically insert data upon creation, cool!

However, this approach doesn’t really work for documents which already exist or where you have a document where you need to populate with data as part of a process, and what happens where you need to amend PDF document? Well, we have you covered with the following actions:

We’re not going to cover how to use the Fill a PDF Form action in this post, but we will be releasing a post shortly covering this.

The Search and Replace Text and Replace Text with Image actions search the contents of either a Word or PDF document and replace targeted phrases with the supplied text or an image. You can also use regex expressions to execute complex find and replace operations.

For example; you could search a document for [APPROVALDATE] and replace with 15th May 2020.

In short; these actions can be used as an alternative to the Microsoft Word Online (Business) premium connector, you just add text placeholders into your document as opposed to a control (much simpler) with the added benefit that the Encodian action can replace data in a document at any time, not just upon creation!

Populate a Word Document using Search and Replace

To demonstrate the capabilities of these actions, we’ve created a very simple Flow snapshot for your review.

The example is based upon this simple employee review document; we’ll replace the following highlighted field initially:

1. Within your Flow, obtain the Word document using a ‘Get File Content‘ action appropriate to where the document is stored – this example uses the SharePoint action.

2. Add the Encodian ‘Search and Replace Text‘ action

2.a. File Type: Select ‘DOCX

2.b Filename: Enter the filename either manually or using dynamic data

2.c File Content: Select the ‘File Content‘ property from the relevant action used in step #1

2.d. Phrases Search Text – 1: Enter [FULLNAME]

2.e. Phrases Is Expression – 1: Select ‘No

For Phrases Is Expression – 1; If you select ‘Yes‘ the ‘ Phrases Search Text – 1‘ will be treated as a regular expression

2.f. Phrases Replacement Text – 1: Enter either a value from dynamic data or manually type

2.g. For the remaining fields simply remove the default values as required to allow the styles of the document to be inherited.

The Encodian ‘Search and Replace Text‘ action will return the Word document with the required changes applied. You then need to add actions to perform your designated steps with the updated file. For this example, we’ll use the SharePoint ‘Create file‘ action to add the updated file to SharePoint

3. Add a SharePoint ‘Create file‘ action

3.a. Site Address: Set to the value of the SharePoint site which contains the target document library

3.b. Folder Path: Set to the value of the target SharePoint folder

3.c. File Name: Select the ‘Documents Filename‘ property from the ‘Search and Replace Text‘ Encodian action

3.d. File Content: Select the ‘Documents File Content‘ property from the ‘Search and Replace Text ‘ Encodian action

Upon executing the Flow you should see the new values within your document:

Populating multiple values in a Document (Word / PDF)

Our Flow is currently replacing a single value, we’re now going to extend the Flow to replace multiple values. The Encodian ‘Search and Replace Text‘ action allows multiple search and replace configurations to be added to a single action:

4. Select the Encodian ‘Search and Replace Text‘ action, click ‘Add new item

5. Configure the configuration item as required (see step #2 for guidance).

Re-run the flow and the document should reflect all of the search and replace configuration items provided

Populating an image in a Document (Word / PDF)

Our final task for this example is to replace the signature placeholder with a signature image

6. Directly after the Encodian ‘Search and Replace Text‘ action; add an Encodian Replace Text with Image action.

6.a. File Type: Select ‘DOCX

6.b. Filename: Select the ‘Documents Filename‘ property from the ‘Search and Replace Text‘ Encodian action

6.c. File Content: Select the ‘Documents File Content‘ property from the ‘Search and Replace Text ‘ Encodian action

6.d. Search Text: Enter [SIGNATURE]

The Encodian ‘Search and Replace Text‘ action requires an image file be passed to the action. Use any Power Automate ‘Get file content’ type action to obtain the required image file.

6.e. Image Filename: Either enter manually or provide via dynamic data

6.f. Image File Content: Select the ‘File Content‘ property from the relevant action used

If you need to resize the image, compress the image or change image file format please review the following Encodian actions: Resize and Image, Compress an Image and Convert Image Format

7. Make sure to update your following actions (Create file in this example) to utilise the ‘File Contents‘ property from the Encodian Replace Text with Image action

The document should now contain your text data and the image!


We hope this post provides useful guidance on how to use Encodian actions to populate Word and PDF documents. If you’re struggling please raise a ticket with our support team who’ll be delighted to help

… and please share any feedback or comments – all are welcome 🙂


  1. Really useful tips, as always. Interested to see how this works in testing, as we are looking at alternate ways to move away from traditional edit and sign, HR docs, at least as an example

  2. vinnie says:

    useful tip, but i am unable to execute the flow, can you please help.

    1. Jay Gooodison says:

      Hi Vinnie,
      Please submit a request to our support team who’ll be able to help.
      Kind regards

  3. A User says:

    Hey bud… step 2a. Enter your Encodian API Key (with link to how to sign up/register for api key etc)

    You kind of look like click bait neglecting to mention in your article that this feature requires one to be used.

    1. Jay Gooodison says:

      This is not specific to this action/flow configuration. Whenever you use any connector in Power Automate for the first time you are prompted to create a new connection (Authenticate), no different for Encodian 🙂 – you can register for an ApiKey here: . We can’t add this to every post, it would add unnecessary overhead to each article.

  4. Robert Kratzke says:

    I created an flow (trigger manual for selected item) to populate Word template from Microsoft Lists. Shared with Team members as “Run only users”

    Do run only users who are manually triggering from a sharepoint/teams LIST need a different license? (THey have M365 Standard licenses.

    1. Jay Goodison says:

      Hi Robert
      The Encodian connector is licenced by the number of actions and not users. I’m not sure what M365 standard licence is 🙂 Assuming you are referring to an E* licence then ‘Power Automate for Microsoft 365’ covers all users to standard capabilities.

  5. Mats says:

    In a multi-stage feedback, approval process the completed word document first need to be converted to PDF format before feedback and approval. can we during the process update the PDF document depending of stage with custom metadata data like reviewer, approver etc. , using action “search and replace text” in the PDF?

    1. Jay Goodison says:

      Yes, that’s just standard Power Automate logic… you can anytime run a search and replace to change the values within the PDF document using the Encodian action. You might also prefer to build an HTML document containing all the reviewer/approval information using the ‘Insert HTML to PDF’ action, see:

  6. Sonam says:

    Hello, Is it possible to create a new word file for every response from a Microsoft form

    1. Jay Goodison says:

      Hi, yes this is covered within this post… just simply create a new file using the ‘File Content’ property returned by the Encodian action. You may also wish to review this post –

Leave a comment

Your email address will not be published. Required fields are marked *