for Microsoft Power Automate and Azure logic apps

Building Word Documents from Microsoft Forms Responses

By Jay Goodison

30th August 2019

Convert Microsoft Forms Responses to Word or PDF Documents

Want to generate Word or PDF documents from Microsoft Forms? You’re in the right place!

We’re 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 pretty self-explanatory, as usual. It allows an HTML file, HTML data or a URL (Results) to be converted into a Microsoft Word document!

If you want to convert to PDF, please check out this article on our support site: Convert HTML to PDF.

NOTE: We have released a new action that simplifies converting Microsoft Forms to Word documents

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 pick up the document and apply further comments for internal records.

Guide

1. Set up a Microsoft Form 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 (a major part of converting Microsoft Forms Responses to Word or PDF)

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, place your cursor in the target location within the HTML and select the required response field from the dynamic data

6.d. Complete 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.

The End!

We hope you’ve found this guide useful. As ever, please share any feedback or comments. All are welcome!

We hope this helps you convert Microsoft Forms Responses to Word or PDF. Who else is ready to get converting?

 

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. And if you do, get in touch!

21 Comments

  1. Eric Halsey says:

    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.

    1. Jay Gooodison says:

      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

  2. Bill says:

    Hello, this is a great capability! Glad I found it. I am trying to use the responses to populate fillable fields in a MS Word document. Basically it is a estimate form where I update the address field and several fields throughout the document using inputs from the MS Form responses. Is this possible?

    1. Jay Gooodison says:

      Hi Bill,
      Absolutely, this post covers how to update data in either a word or PDF document – Populate a Word or PDF Document using Power Automate
      The example uses data from SharePoint, but you’d just swap out for data obtained from a Microsoft forms response.
      HTH
      Jay

  3. Socrates says:

    Hello, Thank you for creating this useful tool. Is there a way to make the make the flow compatible with branching? Some questions on my forms are only asked dependent on the answers on a previous question.

    1. Jay Goodison says:

      Hi, our connector is compatible with branching. You simply need to configure your flow to only populate sections of your HTML where a response has been provided. Please contact our support team if you require further guidance. HTH Jay

  4. Ramon says:

    Good night, I would like to add the attachment images that are loaded in the forms, how could I add the replies and those images in the Word document?

    1. Jay Goodison says:

      Hi,
      You could retrieve the images and embed in the HTML using a DataUri, the following post details how to do this: https://blog.encodian.com/2020/07/converting-html-to-pdf-or-word-with-power-automate/
      HTH
      Jay

  5. Zorica Latinovic says:

    Hi! I followed all the steps, but the flow reports an error:
    {“HttpStatusCode”:400,”HttpStatusMessage”:”Bad request”,”OperationId”:”08f6d56b-4332-4c35-ab78-35db392411bf”,”Errors”:[“Please provide either a HTML document, HTML data or URL and not more than one of these options.”],”Operation Status”:”Error”,”Filename”:null,”FileContent”:null}
    Can you help me? How can I resolve this?

    Thank you in advance!

    1. Jay Goodison says:

      Hi Zorica,
      The error message is stating that you are not passing any data… there is no file, HMTL data or a URL being passed hence why you are getting a ‘Bad Request’ error message.
      You can see what data is being sent by reviewing your run history and checking the inputs / outputs.
      For further support please raise a ticket
      HTH
      Jay

  6. Noms says:

    how do I convert the microsoft form responses into a word/pdf document?

    1. Jay Goodison says:

      Hi, this post covers this topic?

  7. Luke Robinson says:

    Hi I’ve really found this tutorial to be helpful, unfortunately however I’m encountering an error when testing the work flow.

    Error
    Action ‘Convert_HTML_to_Word’ failed

    Error Details
    The response is not in a JSON format.

    The only part I’ve deviated from is “5.b. Response Id: Select the ‘List of response notifications Response Id‘”

    My only option dynamic content offers me to select is “Response Id” could this be the cause?

    Thank you in advance?

    1. Jay Goodison says:

      Hi Luke,
      The response is not in a JSON format is a general message, please refer to the output of the action which will contain a further detailed error message, this may help: https://blog.encodian.com/2020/05/troubleshooting-flows-in-microsoft-power-automate/
      HTH
      Jay

  8. Eleanor says:

    I am trying to convert the responses of Form into a Word document. I am following your instructions, but when I get to #6a, I do not see a request for a file name. I see a request for Connection name, with the next field being API Key. Am I missing a step? Thanks!

    1. Jay Goodison says:

      You need to sign-up for an Encodian API Key here: https://www.encodian.com/apikey

  9. Nick Mills says:

    I have this setup correct and it is creating the file fine. Is there another step I can add that will then send that file to someone as an attachment? Or maybe even a link to the file?

    1. Jay Goodison says:

      Hi Nick, just add the Send Email action and pass the Encodian file content and file name properties to the attachments properties on the Send Email action.

Leave a comment

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