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

This article describes how to create PDF documents from an XLSX template on Plumsail Forms submission with the help of Processes in Power Automate (MS Flow). It may help you to automize the generation of documents like applications, requests, orders, etc., in your company.

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

With Plumsail Forms, you can design elegant, responsive, and highly customizable forms for SharePoint Modern UI or any web page. In our example, we will collect data from a Web Form, apply it to our template and generate a new PDF document with the help of Processes.

Create a Form

We will design a form for a stationery and office supplies request. Here is our result form:

Plumsail Form image

You see, that the form includes information:

  • an ordering employee – here we use mostly text boxes, for the department - a dropdown
  • the order content – we use a DataTable for adding multiple lines to the order
  • under the table with order items, we place a multiline textbox for special instructions
  • and, finally, a submit button

You can create such a form yourself, follow this link to learn more about how to design Plumsail Web Forms.

While creating a Form, pay attention to the internal names of fields. They must correspond to the tokens in your XLSX template. To understand better the form data structure, check this link.

You can use our ready form template for a stationery order request as well. Download the file and import it to the Plumsail Forms designer.

Configure the Process

Now we need to create and configure the Process which will generate stationary requests in PDF format based on data from our Plumsail Form submission.

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 Plumsail Form

Upload the template you will use. In this example, we are going to generate requests for stationery and office supplies. And below is our template for it. You can download it by this link.

Template

When creating your own templates, mind the templating language. Plumsail Excel XLSX 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 {{name}}, {{department}}, etc, that's how the sample JSON for testing might look in our case:

{
  "name": "John Doe",
  "department": "IT",
  "email": "j.doe@contoso.com",
  "items": {
      "Product": "Pen",
      "Quantity": 10
      },
  "instructions": "Delivery before Thursday",
  "phone": "(206)-564-96-97",
  "date": "25/02/2020"
}
test template

It’s testing. We’re going to apply the data from the Plumsail stationery request 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:

xlsx to pdf from Plumsail Forms flow

Form is submitted

We need to start the Flow every time somebody submits our stationery request form. For that, search for Plumsail Forms in Power Automate and add Plumsail Forms - Form is submitted as a trigger.

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

You'll need to add the form ID to track it.

Plumsail Forms trigger

Find and copy it in General settings in Forms Designer.

How to find Plumsail Form ID

Initialize variable

We need to build an array with the data from the Data Table to use it in the JSON Template data in Start document generation process action. So, we create an array of variable items.

Initialize variable

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:
dynamic content of Plumsail form is submitted

This object contains information from our form. We selected the dynamic content from the output of Plumsail Forms - Form is submitted action and from the Initialize variable step:

dynamic content of Plumsail Form is submitted

We also added the current date using a standard MS Flow expression:

formatDateTime(utcNow(),'yyyy-MM-dd')

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 an XSLX template based on the Plumsail 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 Plumsail 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 Plumsail Forms.

Hint

Check out one more example of creating PDF documents from templates on Plumsail Forms submission - How to generate PDF documents from a DOCX template on Plumsail Forms submission.