Press "Enter" to skip to content

Convert Microsoft Forms Responses to Word or PDF Documents

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.

3 Comments

  1. Eric Halsey Eric Halsey

    This is great and I’d like to extend it a bit. We have tons of Google Forms we are migrating to MS Forms. One of the missing features is automatically creating a PDF of the response. Wondering if there is a cleaver way to auto-magically create an HTML table for each answered questions with 2 columns the first for the question and the second with the answer. That way we can re-use the same actions for all of our Forms without having to explicitly create the HTML as in your example. I can get the JSON data but as you might be aware it only includes the question ID’s and not the actual question text. Thanks in advance.

    • Jay Gooodison Jay Gooodison

      Hi Eric,

      There is no magic way of auto generating the HTML table data. If preferred you could make use the ‘Create HTML Table’ action in Power Automate, an example for this is provided here: https://blog.encodian.com/2020/01/convert-sharepoint-list-items-to-pdf/
      Check out steps 5 > 6 in the ‘Convert multiple SharePoint List Items to PDF‘ section
      I don’t think does solve your challenge however as you still need to pass the data from each individual form, and given the ID’s of the questions will be different you would need to update each time.
      If you need further help please raise a support ticket via https://support.encodian.com/hc/en-gb/requests/new

Leave a Reply

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