How to create Word and PDF documents from Microsoft Forms in Power Automate (MS Flow) and Azure Logic Apps

This article demonstrates how to create PDF documents from a DOCX template on a Microsoft Form submission with the help of Processes in Power Automate (MS Flow). It may help you to automize the generation of different documents like applications, requests, orders, etc., in your company.

Processes are a Plumsail Documents feature with an intuitive interface for creating documents from templates.

Microsoft Forms are an online form builder with themes and question branching that allows you to create surveys, quizzes, polls and collect other information.

Let’s see how to connect them with the help of Power Automate (Microsoft Flow) to automatically collect data from a Microsoft Form, apply the data to our template, and generate a new PDF document.

Create a Form

We наve already created a Microsoft Form with a guest's request. We will use data from its submission. If you haven't created MS Forms before, follow this 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 this 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:

Microsoft Form

Configure the Process

Before creating the Flow, we also need to configure the Process, which will generate PDF documents from a DOCX template.

Create a new process

Go to the Processes section in your Plumsail account.

Click on the Add process button.

add process button

Set the Process name.

generate PDF from Typeform

Upload the template you're gonna use. In this example, we'll create a guest's request. And below is our template for it. You can download it by this link.

Docx template

When creating your own ones, 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. Read this article to get familiar with the templating engine.

Configure a template

Once you're done with the first step Create Process, press the Submit button, and you’ll proceed to the next – Configure Template:

  • Fill in the name of the result file
  • Select PDF format for the output file
  • Protect the result PDF if you wish
Configure template

You can test a template as well, to see how it will look at the end. After clicking on the Test template button, you’ll need to ‘feed’ a template with your data in JSON format. To understand what JSON to feed, you need to look at tokens in your template. In our template we have {{Fullname}}{{PhoneNumber}}, etc, that's how the sample JSON for testing might look in our case:

{
  "FullName": "Nikola Vlasic",
  "PhoneNumber": "+8987654321",
  "ApartmentNumber": "124",
  "Request": "The tap in the kitchen is dripping. Could you send a plumber, please?"
}
test template

It’s testing. We’re going to apply the data from the Microsoft Form to our template.

Delivery

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 don't need to put .extension, it'll be done automatically based on the output file type you set on the Configure template step.

create pdf from template on form submission

You can configure as many deliveries as you need.

Start the Process

We will start our Process from Microsoft Flow.

Create a Flow

This is how our Flow looks:

pdf from Microsoft Form flow

Check out the Flow steps described below.

Form is submitted

We need to start the Flow every time somebody submits our request form. For that, search for Microsoft Forms in Power Automate and set Microsoft Forms - When a response is submitted as a trigger.

If this is your first Flow with Microsoft Forms, on this step, sign in to your Microsoft Forms Account from MS Flow to use your forms inside Flows.

Then, you'll need to pick the form you want to track in the dropdown.

Microsoft Form trigger

Get response details

As we want to get the submitted data, 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:

Get response details

Start document generation process

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''.

create flow connection

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 two parameters:

start generation documents action
  • Process name. Select the process you need from available ones.
  • Template data. Specify source data in JSON format:
Template data in JSON format

This object contains information from our form. We selected the dynamic content from the output of Microsoft Forms - Get response details action:

Menu on the right

Use the ready document in Flow

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:

Final document

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.

send pdf for approval

Sign up for Plumsail Documents

As you can see, it's simple to automize 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.

Hint

You can generate PDFs from Web Forms even without Power Automate (Microsoft Flow). Check the article How to generate PDF documents from a DOCX template on Plumsail Forms submission.