Populate a Word document with Microsoft Flow

A few weeks ago a client asked to create a workflow that pre-populates a Word document with some data from a SharePoint list. This was my chance to use the new Microsoft Flow action called: Populate a Microsoft Word template.

This action can read a Word document and populate the fields you defined. You can add fields to a Word document via the “Developers tab” in Word. You have to enable this first when you haven’t done this before. If you are not sure how to do this you can check this help page.

For now the Flow action only works when these conditions are met:

  1. Only text controls are allowed (no checkboxes and so)
  2. The file must be on your OneDrive for Business, not on a SharePoint library (I hope this changes real soon!)

So I created a word file with a plain text control and stored it on my OneDrive for Business folder.

Next I created a SharePoint list where the customer added an item for each meeting that was organized. The item contains a text field with the names of the attendees.

The create the Word document I created a Flow that runs for a selected item in that list. In this development example I created an input field to test the flow:

next you need to populate the Word file (I fetch the data from the listitem first to use later in the flow)

To finish I create a new Word file on a SharePoint library:

So in this flow I

  • Populated a Word document with some data from a SharePoint list item
  • Created a file with that content to a SharePoint list

There are still some issues with this Flow action but it looks promising. I hope that soon we can populate other fields (repeating fields??) and the template file can be stored on SharePoint instead of OneDrive for Business.