- Home
- Guides
- Power Automate
- How to generate Word documents from Excel and Microsoft Forms with Power Automate
How to generate Word documents from Excel and Microsoft Forms with Power Automate
Build a document generator that takes a short Microsoft Form, looks up the full record in Excel, and creates a formatted, editable Word document that is emailed to you. It uses standard Microsoft 365 connectors only.
Jump to a step (14)
Property managers, HR and office admins retype the same tenant, client or employee details into Word every time they need an agreement or letter. It is slow and easy to get a name, date or rent amount wrong. The usual automation (Populate a Microsoft Word template) is a premium action, and most free tutorials need SharePoint.
In the video I build a residential lease renewal agreement because it covers dates, currency values and a calculated date in one example. You pick the tenant in Microsoft Forms and enter only what is new: the renewal rent, the new lease end date and any extra terms. Power Automate finds the tenant in Excel, drops every value into an HTML version of the Word template, saves it to OneDrive as a .doc file that opens in Word, emails it to you and writes the new rent and end date back to Excel.
The trick is that Word reads HTML. You turn your Word template into HTML once (ChatGPT does this for you), keep it in a single Compose action, and replace the placeholders with dynamic values. There is no template file to manage and no content controls.
What you need
- Microsoft 365 Business Basic or Standard (standard Power Automate connectors only)
- An Excel table in OneDrive for Business with a unique ID column (the demo uses Tenant ID)
- A Microsoft Form with a record drop-down, the ID, and the new values for the document
- Your Word document with the changing values highlighted in yellow
- ChatGPT, Claude or another AI tool to turn the Word document into HTML
- A OneDrive folder for the generated documents
Step by step
0 of 14 done-
01
Prepare the Word template
Open the Word document you want to generate and highlight in yellow every value that changes per record. In the demo that is the agreement date, tenant name, address, unit, dates, rents, deposit, parking, pet terms and utilities.
Everything else (header, section wording, tables, terms, signature area) stays the same every time.
-
02
Set up the Excel database as a table
Give each record a unique ID column. Power Automate uses it to find the right row. The demo tenant database has
Tenant ID,Tenant Name,Email,Property Address,Unit,City,State,Zip,Current Rent,Lease Start Date,Lease End Date,Security Deposit,Parking,Pet TermsandUtilities Included.Select the data, choose
Format as Tableand pick a style. UnderTable Designyou can see the table name (Table1in the video). Add or remove columns to suit your own document. -
03
Build the Microsoft Form
Create a form that asks only for what is new:
- A choice question set to a drop-down to pick the tenant
Tenant IDas a text fieldRenewal Monthly Rentas a text fieldNew Lease End Dateas a date fieldAdditional Renewal Termsas a long text field
The person reads the ID in the drop-down option and types it in the Tenant ID field. You could pull the ID out of the drop-down value with an expression instead, but the separate field keeps the flow simple.
-
04
Fill the drop-down from Excel with CONCAT
In a helper column in Excel, combine the ID, name, property and unit with
CONCAT, separated by dashes, for example=CONCAT([@[Tenant ID]]," - ",[@[Tenant Name]]," - ",[@[Property Address]]," - ",[@Unit]).Copy the whole helper column and paste it into the Forms choice question. Forms creates one option per line, so you do not type them one by one. Then switch the question to a drop-down.
-
05
Create the automated cloud flow
In Power Automate select
Create>Automated cloud flow. Name it (the demo usesTenant Lease Renewal Agreement), search for Forms and choose the triggerWhen a new response is submitted. Select your form inForm Id. -
06
Get the response details
Add the Microsoft Forms action
Get response details. Select the same form, and forResponse Idchoose theResponse Idoutput from the trigger. This gives you the actual answers. -
07
Find the record in Excel with Get a row
Add
Get a rowfrom Excel Online (Business).Location: OneDrive for BusinessDocument Library: OneDriveFile: your tenant databaseTable:Table1Key Column:Tenant IDKey Value: the Tenant ID answer from Get response details
Under
Advanced parameterssetDateTime FormattoISO 8601. This returns dates in a format Power Automate can work with, without a complicated conversion expression. -
08
Turn the Word template into HTML with ChatGPT
The Power Automate action
Populate a Microsoft Word templateis premium, so this build uses HTML instead.Upload the Word document (filled with demo data, changing values in yellow) to ChatGPT or any AI tool. The prompt asks it to create a complete HTML version for Power Automate, replace each yellow highlighted value with a clear, human-readable placeholder named after the field (for example
<<Tenant Name>>), use the Aptos font at size 10.6, and follow your other formatting rules.Open the code view and copy the HTML. It will not look like the final document in the chat, but it will once Word opens it.
-
09
Paste the HTML into a Compose action
Add a
Composeaction, rename itHTML Templateand paste the HTML intoInputs. The whole document lives in this one action, and you replace the placeholders right where they sit. -
10
Replace the placeholders with dynamic values
Delete each placeholder and insert the matching value. Type
/and chooseInsert dynamic contentorInsert expression.- Agreement date: the form
Submission time, formatted with an expression that converts it to your time zone, for exampleformatDateTime(convertTimeZone(<Submission time>,'UTC','Pacific Standard Time'),'MMMM d, yyyy'). ChangePacific Standard Timeto your own time zone. - State, tenant name, property address, unit, city, zip, current rent, security deposit, parking, pet terms, utilities: from
Get a row. - New lease start date: the current lease end date from Excel plus one day, for example
formatDateTime(addDays(<Lease End Date>,1),'MMMM d, yyyy'). - New lease end date, renewal monthly rent, additional terms: from
Get response details.
Scroll through the whole template, including the signature section, so you do not miss a placeholder. In the video I missed one property address and had to go back.
- Agreement date: the form
-
11
Create the Word file in OneDrive
Add the OneDrive for Business action
Create fileand rename itCreate Word file. Pick a folder you created (the demo usesLease Agreement Files).For
File NametypeLease Renewal-, add the Tenant ID and Tenant Name from Excel with dashes, and end with.doc. ForFile Contentpick the output ofHTML Template.The file is HTML, but the
.docextension tells Word to open it. Word applies the fonts, tables and spacing and gives you a normal editable document. -
12
Email the document as an attachment
Add
Get file content(OneDrive for Business) and setFileto theIdfromCreate Word file. You need the content to attach it.Then add
Send an email (V2)from Office 365 Outlook. Enter the recipient, a subject and body with the tenant name, property address and unit, and reuse the same date expressions in the body. UnderAdvanced parametersaddAttachments, set the name (tenant name, property and unit, ending in.doc) and setAttachments Contentto theFile ContentfromGet file content. -
13
Write the new values back to Excel
Add
Update a rowfrom Excel Online (Business) with the same file,Table1, key columnTenant IDand the Tenant ID from the form as the key value.Under
Advanced parameterspickCurrent RentandLease End Date. Set Current Rent to the renewal monthly rent from the form, and Lease End Date to the new lease end date formatted with an expression, for exampleformatDateTime(<New Lease End Date>,'yyyy-MM-dd').This runs after the row was already read, so the document still shows the old rent as the current rent. The update only affects the next renewal.
-
14
Test the flow
Save, select
Test>Manuallyand submit the form. In the demo I pick tenant 210, enter 3500 as the new rent and 28 February 2027 as the end date.Check the email, download the attachment and select
Enable Editing. All fields should be filled in. Edit anything you need, then print or save as PDF. Open Excel and confirm the row has the new rent and end date.
Tips and common problems
- Populate a Microsoft Word template is a premium action. The HTML in a Compose action plus a .doc file gets you a formatted, editable Word document with standard connectors only.
- Set DateTime Format to ISO 8601 in Get a row. Without it Excel returns dates as serial numbers that are hard to format.
- Submission time is in UTC. Use convertTimeZone in the date expression and change Pacific Standard Time to your own time zone.
- If the email subject or body shows extra square brackets around a value, remove them from the text around the dynamic content. It happened in the test run in the video.
- Save the file with .doc, not .docx. The content is HTML, and Word only opens it correctly with the .doc extension. You can then save it as .docx or PDF from Word.
- Put Update a row after the document is created, so the document uses the current rent before Excel is overwritten.
How the flow is put together
| Step | Connector and action | What it does |
|---|---|---|
| 1 | Microsoft Forms: When a new response is submitted | Starts the flow |
| 2 | Microsoft Forms: Get response details | Reads the answers |
| 3 | Excel Online (Business): Get a row | Finds the record by Tenant ID (DateTime Format ISO 8601) |
| 4 | Compose | HTML template with placeholders replaced |
| 5 | OneDrive for Business: Create file | Saves the HTML as a .doc file |
| 6 | OneDrive for Business: Get file content | Reads the file for the attachment |
| 7 | Office 365 Outlook: Send an email (V2) | Emails the document |
| 8 | Excel Online (Business): Update a row | Writes the new rent and end date back |
Need a PDF instead of a Word file? See Convert Microsoft Forms responses to PDF and email them.
Questions
Can I generate a Word document from Microsoft Forms without a premium Power Automate license?
Yes. This flow uses only Microsoft Forms, Excel Online (Business), OneDrive for Business and Office 365 Outlook. It skips the premium Populate a Microsoft Word template action and writes an HTML file with a .doc extension that Word opens as a normal document.
Do I need SharePoint to fill a Word template with Power Automate?
Not with this method. The Excel database and the generated documents live in OneDrive for Business, and the template is HTML inside a Compose action, so there is no SharePoint library or Quick Parts setup.
Why does the generated file end in .doc instead of .docx?
The file content is HTML. The .doc extension tells Word to open it, and Word reads the HTML and applies the formatting. Once it is open you can save it as .docx or PDF.
Can I use this for offer letters or service agreements?
Yes. The flow stays the same. Change three things: your Excel file (keep a unique ID column), your template (highlight the changing values and run it through the same prompt), and your form (ask only for what is new).
