Power Automate: Create Word Document With A Repeating Section
Power Automate: Create Word Document With A Repeating Section Posted by - Matthew Devaney on - July 10, 2022 83 Comments Power Automate can populate a word d...
- Published
- Reading time
- 6 min read
Before you start
Is this guide for you?
- Best entry point
- Power Automate
- Time investment
- 6 min read
Imported reference from Matthew Devaney's blog for learning purposes. Original: https://www.matthewdevaney.com/power-automate-create-word-document-with-a-repeating-section/. Author: Matthew Devaney.
Power Automate: Create Word Document With A Repeating Section Posted by - Matthew Devaney on - July 10, 2022 83 Comments
Power Automate can populate a word document template with values and convert the document to PDF . Updating single text fields in a PDF is easy but implementing a repeating section requires different code. Repeating sections are typically used to display data tables. The table heading is displayed only one while the rows beneath it are repeated for each record in a SharePoint list (or Dataverse table). In this article I will reveal how to add a repeating section to a Word document template and populate it using Power Automate. Table of Contents
Introduction: The Daily Real Estate Sales Report Setup The SharePoint List
Enable The Developer Tab In Microsoft Word
Insert A Table Into The Word Document Template
Add Plain Text Fields To The Word Document Repeating Section
Insert A Repeating Section To The Word Document Template
Save The Word Document Template To OneDrive
Populate The Word Document With A Repeating Section
Generate The Word Document With A Repeating Section Using Power Automate
Introduction: The Daily Real Estate Sales Report
Managers at a real estate firm use the Real Estate Sales Report to show how many homes were sold in a market each day. The PDF report is sent via email at the end of each week.
Power Automate Word Document repeating section Setup The SharePoint List
Create a SharePoint list called Daily Real Estate Sales with these columns: Sale Date (date only) City (single-line text) Units Sold (number) Total Sales (number) Average Sell Price (number)
Populate the list with the following data: Sale Date City Units Sold Total Sales Average Sell Price 6/13/2022 Atlanta 25 8,579,200 343,168 6/13/2022 Boston 15 5,014,515 334,301 6/13/2022 Chicago 30 14,172,090 472,403 6/13/2022 New York 48 23,879,856 497,497 6/13/2022 Philadelphia 23 7,564,516 328,892 6/14/2022 Atlanta 35 13,676,355 390,753 6/14/2022 Boston 24 14,016,960 584,040 6/14/2022 Chicago 15 6,539,205 435,947 6/14/2022 New York 24 11,511,384 479,641 6/14/2022 Philadelphia 37 13,901,566 375,718 6/15/2022 Atlanta 10 3,249,120 324,912 6/15/2022 Boston 29 11,682,505 402,845 6/15/2022 Chicago 34 18,767,490 551,985 6/15/2022 New York 10 2,894,770 289,477 6/15/2022 Philadelphia 20 4,925,920 246,296 6/16/2022 Atlanta 40 15,759,440 393,986 6/16/2022 Boston 35 11,783,205 336,663 6/16/2022 Chicago 28 14,027,972 500,999 6/16/2022 New York 35 9,522,625 272,075 6/16/2022 Philadelphia 12 3,795,204 316,267 6/17/2022 Atlanta 40 20,885,240 522,131 6/17/2022 Boston 21 8,385,825 399,325 6/17/2022 Chicago 38 12,316,674 324,123 6/17/2022 New York 11 3,987,852 362,532 6/17/2022 Philadelphia 16 6,074,896 379,681
Enable The Developer Tab In Microsoft Word
The Daily Real Estate Sales Report is a Word document template that gets populated by Power Automate. Then it gets converted into a PDF and is sent via email. We will work on the Word document template first. Open Microsoft Word and start a new document.
Right-click on any tab in the ribbon and select Customize the Ribbon .
Check the developer tab and then press OK. The developer tab will now appear in the ribbon and we can use it to create fillable fields in the Word document.
Insert A Table Into The Word Document Template
The Daily Sales Report shows multiple rows of data inside a table. Go to the Insert tab and create 5 column and 2 row table.
Add the column headings to the first row of the table and leave the second row of the table blank.
Add Plain Text Fields To The Word Document Repeating Section
Each empty field in the second row will be populated with a text field and then we will use a repeating section to create a new row for each SharePoint list item. Place the cursor inside the empty table cell for Sale Date then click the plain text button on the menu.
A blank plain text field will appear in the table cell. Enable Design mode to see it. Then highlight the plain text field and select Properties .
Input the title and tag for the plain text field. Then press OK.
The title of the plain text field will appear at the start and the end of the field.
Repeat this step for each cell in the second row of the table.
Insert A Repeating Section To The Word Document Template
The second row of the table must be repeated for each row in the Daily Real Estate Sales SharePoint list. Highlight the entire row and select the repeating content button from the menu.
Then select the Properties button and name the repeating section Table Rows .
The Word document repeating section should look like this. We are now finished setting up the template. Save and close the Word document.
Save The Word Document Template To OneDrive
We will use Power Automate to generate the sales report. For Power Automate to access the Word Document template it must be stored in a SharePoint document library or OneDrive. In this tutorial we will use OneDrive. Save the Word document template to the root folder of OneDrive.
Populate The Word Document With A Repeating Section
Open Power Automate and build a new instant cloud flow. Name the flow Real Estate Sales Report . Choose the trigger called Manually trigger a flow and click Create . Do not add any inputs to the flow.
Insert a Get Items action to obtain all of the Daily Real Estate Sales SharePoint list items.
Add a Select action from the Data Operations actions set to transform the SharePoint list into an array with only the required columns. Then insert a Populate a Microsoft Word
template action and apply it to the Real Estate Sales Report Word document template. Click on the repeating section icon to change the input method.
Then apply the Output of the Select action code to the Table Rows property. This creates a new row in the Word document table for each row in the Daily Real Estate Sales SharePoint list.
Create a file using the Microsoft Word document body. Convert the Word Document to PDF.
Then Send an Email (V2) with the Daily Real Estate Sales Report as an attachment. We are now done creating the Power Automate flow.
Generate The Word Document With A Repeating Section Using Power Automate
Run the Power Automate flow to generate the Daily Real Estate Sales Report .
The PDF document received via email looks like this. Did You Enjoy This Article? 😺
Subscribe to get new Power Apps articles sent to your inbox each week for FREE Enter your email address Sign Me Up Questions?
If you have any questions about Power Automate: Create Word Document With A Repeating Section please leave a message in the comments section below. You can post using your email address and are not required to create an account to join the discussion. Matthew Devaney Power Automate
Save Docusign Document To SharePoint With Power Automate
Tagged
Power Automate
Have a Microsoft 365 topic idea?
Share article suggestions, community session ideas, corrections, or real-world scenarios for future nxtM365 learning notes.
Keep learning Microsoft 365
Explore more practical guides for SharePoint, Power Platform, Copilot Studio, migration, automation, governance, and security.
Continue learning
Related tutorials
Related questions
Related comparisons
Next action