This article demonstrates how to export Microsoft Form to Word document and convert the resulting file to PDF. It may help to automate the creation of certificates, applications, requests, and other documents from Microsoft Forms.
To follow the steps from the article, you will need these accounts:
We’ll connect Microsoft Forms to Plumsail Documents using the Power Automate (Microsoft Flow) platform. We’ll create an automated flow to automatically export data from a Microsoft Form, apply the data to our Word template, and generate a new PDF document. We’ll also take a look at the case when the MS form has an image upload in the Advanced Case section.
You can watch the below video to understand the logic. Otherwise, follow the steps from the article.
Table of contents
First, you need to create a Microsoft form. We наve already created a guest’s request form. We will use data from its submission. If you haven’t created MS Forms before, follow the link to learn how to do it.
It’s possible to use the form from this example. After you’ve logged into your Microsoft Forms account, click on the link to duplicate the form. After duplicating you’ll be able to use the form as your own.
Below is a screenshot of the form:
Next, you need to go to your Plumsail account - Processes section - and add a new process:
Set the Process name. Select DOCX for a template type.
Once the process is created, you’ll see the Configure template step including two substeps:
Editor;
Settings.
In Editor, you can compose the template from scratch or upload a pre-made one. It’s also possible to modify the uploaded template online.
Feel free to download a DOCX template we have prepared beforehand. It’s a guest’s request:
Then upload it to the process.
When creating your own templates, mind the templating language. Plumsail Word DOCX templates use a different approach than most other templating solutions. It uses a minimal amount of syntax to make your work done.
In short, the templating engine thinks that everything between curly {{ }}
brackets is variables where it will apply your specified data.
Press Save&Next to proceed further - to the Settings substep:
Switch to an active mode to remove Plumsail watermarks from resulting documents
Fill in the name of the result file
Select PDF as the output file format to convert the resulting document to PDF
Select locale
Protect the result PDF if you wish
The next step is delivery. For demonstrating purpose, we’ll store the result file in OneDrive. But there are other options.
Select the folder where the ready document will be saved. Fill in the file’s name.
You can configure as many deliveries as you need. For instance, you can also save the resulting PDF in SharePoint.
We will start our Process from Power Automate (Microsoft Flow).
This is how our Power Automate Flow looks:
Check out the Power Automate Flow steps described below.
We need to start the Flow every time somebody submits our request form. For that, search for Microsoft Forms in Power Automate and set When a response is submitted as a trigger.
If this is your first Flow with Microsoft Forms, on this step, sign in to your forms account from Power Automate to use your forms inside Flows.
Then, you’ll need to pick the form you want to track from the dropdown.
As we want to extract data from Microsoft form, we need to add Microsoft Forms - Get response details action. On this action, we select the same Form Id that we used in the trigger. Then, we click in the Response Id text box and pick List of response notifications - Response Id in the Dynamic content menu on the right:
This is the action from Plumsail Documents connector. This action is suitable for starting the Process of generating documents from a template. You can find more information about this action by visiting this page.
Using the action for the first time, you’ll be asked for ‘’Connection Name’’ and ‘’Access Key’’.
You can type any name for the connection. For example, ‘’Plumsail Documents’’.
Then create an API key in your Plumsail Account page, copy and paste it to ‘’Access Key’’ field.
The action has several parameters:
Process name. Select the process you need from available ones.
Fields for entering data. The number of fields depends on the number of tokens in the DOCX template.
This object contains information from our form. We selected the dynamic content from the output of Microsoft Forms - Get response details action:
You can stop on the step Start document generation process.
Steps described above are enough for generating PDFs from a DOCX template based on the Microsoft Form submission. Your result file will be saved to OneDrive in this case. See how it will look:
But if you need an advanced logic, it’s possible to work with the result file right in the Flow.
Here is an example of how you can send the ready document for approval.
Add an action Create an approval from the Approvals connector. Select an output of the previous step for an attachment.
Let’s imagine that we want our requester to submit a photo of their problem:
To achieve this, we will add an image upload option to the Microsoft Form and then include the uploaded image in the resulting PDF.
The Microsoft Form may look like this:
Then, we add a new token {{imageData}:picture} with the picture formatter to insert the image into the DOCX template.
Download the DOCX template with the image token.
Also, we need to add some actions to our flow to process the image:
First, we add Parse JSON action to get the image dynamic content.
We generate the scheme from a sample. To get the sample we can run our flow with just Get response details action and copy the line from the image field.
Then click Generate from sample in the Parse JSON action and insert the copied sample JSON payload.
On the next step we get the image file content with the help of OneDrive for business connector and use id dynamic data from the Parse JSON action.
Note
Power Automate automatically adds Apply to each action.
Finally, we add the Start document generation process action and select the dynamic content from the OneDrive for business action. We need to use this expression to get the file content though.
body(‘Get_file_content’)[‘$content’]
That’s it! The flow to convert Microsoft Form responses and an image attachment into a PDF is complete.
As you can see, it’s simple to automate the generation of documents on Microsoft Forms submission. If you’re new to Plumsail Documents, register an account and follow the steps described in the article to set the process for automatic creation of PDFs from Microsoft Forms. A 30-day trial is free.