Press "Enter" to skip to content

Building Word Documents from Microsoft Forms Responses

We’re really excited to announce that our new Power Automate action ‘Convert HTML to Word‘ is now globally available within all Microsoft Power Automate regions. The action is fairly self-explanatory as usual, it allows either a HTML file, HTML data or a URL (Results) to be converted into a Microsoft Word document!

If you’re looking to convert to PDF, please check out this article on our support site: Convert HTML to PDF

Scenario

Our support team periodically issue a customer satisfaction survey using Microsoft Forms. We need to get the results of each response and generate a word document containing extracted results allowing a support representative to pickup the document and apply further comments for internal records.

Guide

1. Setup and create a Microsoft Form which is configured to capture the required information.

2. Create a new Flow using the ‘Automated — from blank‘ option

3. Enter a name for the Flow, select the SharePoint ‘When a new response is submitted‘ Forms trigger, click ‘Create

4. Select the target form

5. Add a ‘Get Response Details‘ action

5.a. Form ID: Select the form as per step 4

5.b. Response Id: Select the ‘List of response notifications Response Id‘ from the ‘When a new response is submitted‘ action

6. Add the Encodian ‘Convert HTML to Word‘ action

6.a. Filename: Enter the name of the output file (docx). You may wish to generate a unique filename by using the concat expression such as:

concat('FormsToWordDemo-',utcNow(),'.docx')

6.b. HTML Data: Copy and paste the HTML data into the field. This demonstration uses this simple HTML snippet:

<html>
	<head>		
		<meta charset="UTF-8">
	</head>
	<body style="font-family:arial">
		<div style="padding-left: 12px;">
			<h2>Encodian Customer Satisfaction Survey</h2>
		</div>
		<div>
			<table style="width: 100%;"  cellpadding = "10">
				<tbody>
					<tr>
						<td><b>Submitted By<b></td>
						<td></td>
					</tr>
					<tr>
						<td><b>Submitted On<b></td>
						<td></td>
					</tr>
					<tr>
						<td><b>Overall, how satisfied are you with our company?<b></td>
						<td></td>
					</tr>
					<tr>
						<td><b>Please explain your satisfaction level in the question above.<b></td>
						<td> </td>
					</tr>
					<tr>
						<td><b>How well do our products meet your needs?<b></td>
						<td> </td>
					</tr>
					<tr>
						<td><b>How would you rate the value for money of the product?<b></td>
						<td> </td>
					</tr>
					<tr>
						<td><b>How responsive have we been to your questions or concerns about our products?<b></td>
						<td> </td>
					</tr>
					<tr>
						<td><b>How long has your organization been a customer of our company?<b></td>
						<td> </td>
					</tr>
					<tr>
						<td><b>How likely are you to continue doing business with us in the future?<b></td>
						<td> </td>
					</tr>
					<tr>
						<td><b>How likely are you to recommend our company to a friend or colleague?<b></td>
						<td> </td>
					</tr>
					<tr>
						<td><b>Encodian Comments<b></td>
						<td> </td>
					</tr>
				</tbody>
			</table>
		</div>		
	</body>
</html>

6.c. To interlace the response data simply place your cursor in the target location within the HTML and select the required response field from dynamic data

6.d. Complete for all required fields

7. Add a ‘Create File‘ SharePoint action

7.a. Site Address: Set to the target SharePoint site

7.b. Folder Path: Set to the target SharePoint library and folder

7.c. File Name: Select the ‘Filename‘ field from the ‘Convert HTML to Word‘ action

7.d. File Content: Select the ‘File Content‘ field from the ‘Convert HTML to Word‘ action

8. Test the Flow by submitting a response to the target Microsoft Form

9. Validate the flow run has successfully executed

10. Check the Word document has been created

11. Validate the Word document with Microsoft Word

The ‘HTML to Word’ action also allows the conversion of HTML files and data retrieved from a URL.

We hope you’ve found this guide useful, as ever please share any feedback or comments, all welcome!

NOTE: HTML layouts are constrained by the HTML support provided by Microsoft Word. If you have a complex div / js / css based layout you may experience some challenges.

Be First to Comment

Leave a Reply

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