Power Automate | Populate Word Table Templates

 

Using Power Automate to Populate Word Templates


In this blog post, we'll explore how to automate document generation using Power Automate. Specifically, we'll focus on a scenario where we retrieve data from Microsoft Dataverse, select relevant information, and populate a Microsoft Word template dynamically. The final document will then be stored in OneDrive for Business.

Prerequisites:

  1. Microsoft Power Automate account.
  2. Access to Microsoft Dataverse entities.
  3. OneDrive for Business account.

Word Document: 
Refer to this blog for tutorial on how to configure the word document:

Step 1: Create a New Flow

  • Start by creating a new flow in Power Automate.
  • Choose the "Instant - from blank" template with a manual trigger.


Step 2: Connect to Dataverse

  • Add a "List Records" action to retrieve records from Dataverse.
  • Configure the connection to the Common Data Service for Apps.


Step 3: Select Relevant Data

  • Add a "Select" action to choose specific fields from the retrieved records.
  • Define the fields you want to use in the Word template (e.g., ID and Subject).


Step 4: Populate Word Template

  • Incorporate the "Populate_a_Microsoft_Word_template" action to dynamically populate a Word template.
  • Configure the connection to the Word Online Business API.
  • Specify the Word document template ID and provide the dynamic content from the selected records.
  • Before Clicking on Switch to "Input entire array", fill all the fields. 

  • After selecting "Input entire array", a JSON array will be visible. Our "Select" Output should match the schema of the JSON visible. 
  • Replace the JSON Array with Dynamic Content of Output of "Select" action in the "Array input"


Step 5: Create a Temporary Word File

  • Add a "Create_file" action to create a temporary Word file in OneDrive for Business.
  • Configure the connection to OneDrive for Business.
  • Specify the folder path and name for the temporary Word file.


Step 6: Run the flow:

Save and run your test flow by clicking on the "Test" button.

Follow the manual trigger prompts or input any required parameters.

Monitor the execution of the document generation flow within the Power Automate environment.


Output of the document Populated:




Conclusion: 

This Power Automate flow showcases the seamless integration of Dataverse, Word Online Business, and OneDrive for Business to automate document generation. By selecting relevant data and populating a Word template, you can efficiently create customized documents with minimal manual effort.


Download Solution: 

Download the solution from my GitHub

Populate Word Table Template


Feel free to customize this flow to suit your specific use case, whether it involves additional data sources, more complex templates, or different storage solutions.


Comments

Post a Comment