Create PDF from Microsoft Forms via Power Automate

This Power Automate Tutorial will guide you on creating a PDF from Microsoft Forms using Power Automate. I will show you step by step, how to create a pdf from Microsoft Forms via Power Automate.

We recently received a request to create a PDF using Microsoft Forms with Power Automate. That means, when a user submits the response from the Microsoft Form, it will convert the Form into PDF and store it in a specific SharePoint document library.

Here, we will see how to create a Microsoft Form within the Forms and convert a PDF from the Microsoft Forms when it is responded to. After that, we will save that PDF file into a specific document library.

Create a Microsoft Form

You can generate surveys, quizzes, and polls using Microsoft Forms, ask people to respond to them using virtually any web browser or mobile device, view real-time results as they come in, use built-in analytics to assess responses, and export findings to Excel for further analysis or grading.

To create a Microsoft Form, the following steps are:

  • Open the Microsoft Forms home page. If you are not logged in, then it will ask you to sign in with your Microsoft 365 credentials.
  • Alternatively, you can also navigate to Forms by clicking on the App launcher > Forms.
Open Forms from the SharePoint site app launcher
Open Forms from the SharePoint site app launcher
  • The Microsoft Form environment will be redirected, where we can create a form. Click the + New Form button on the Forms home page to start a new Microsoft Form.
  • Provide a name to the Microsoft Form and the form’s description.
Create PDF from Microsoft Form via Power Automate
Create PDF from Microsoft Form via Power Automate
  • It allows adding different types of questions such as choice, text, rating, date, ranking, Likert, upload File, and net promoter. To add the question click on the Add new button.
  • Add different types of questions based on the requirement. Below, I have added different types of questions based on the Employee Health and Travel Declaration.
  • Here, is the overview of the Microsoft Form that I have created.
Example of Microsoft Form
Example of Microsoft Form
  • To copy the link for further use, click on the Collect responses(on the right side) > Copy the link > Open into another tab.
Convert Microsoft Forms to PDF format via Power Automate
Convert Microsoft Forms to PDF format via Power Automate

This is how to create a Microsoft Form and copy the link to share it with others.

See also  How to create Power BI report from SharePoint list + Excel

Create Flow to convert the Microsoft Form to PDF

As per the requirement, we will create an automated cloud flow that will be triggered when someone responded to the Microsoft form and convert that form to a PDF. Also, the PDF will be stored in a specific document library.

To create a flow, the following steps are:

  • On Power Automate, click on Create (from the left navigation) > Automated cloud flow. Provide the Flow name and select the trigger ‘When a new response is submitted‘. Click on Create.
  • It will redirect to the flow creation page. On the trigger, give the Form Id (Pick the respective form from the dropdown).
Build PDF from Microsoft Form via PowerAutomate
Build PDF from Microsoft Form via PowerAutomate
  • Next, we will add an action to get the response details from the submitted form. Click on the New step > Get response details. Give the properties value as below:
    • Form Id: The name of the Microsoft Form (i.e., Employee Health and Travel Declaration Form).
    • Response Id: Response Id (Select the value from the trigger’s dynamic content).
Power Automate to Convert Microsoft Forms to PDF
Power Automate to Convert Microsoft Forms to PDF
  • Once the flow gets the response details, we will add another action ‘Select‘ that will fill a new array with the requested properties from all elements of the ‘From‘ array.
  • Under the ‘Get response details, click on the +New step > Select. Insert the below expression on the From.
createArray(triggerOutputs()?['body/resourceData/responseId'])
  • Similarly, in the Map, insert the questions from the Microsoft Form in sequential order and provide their respective values from the dynamic content of the Get response details.
How to generate a PDF from Microsoft Forms Power Automate
How to generate a PDF from Microsoft Forms Power Automate
  • Once the array is created, we will create an HTML table. Click on the + New step > Create HTML table. Set the From as Output from the dynamic content of the Select.
How To Save Microsoft Forms Responses In PDF using Power Automate
How To Save Microsoft Forms Responses In PDF using Power Automate
  • Once the HTML table is created, add a Compose action to add a border to the HTML table. Click on the +New step > Compose. Insert the below expression on the Inputs property.
replace(body('Create_HTML_table'),'<table>','<table border = "2">')
How to Create PDF from Microsoft Form using Power Automate
How to Create PDF from Microsoft Form using Power Automate
  • Next, add another action to create this HTML table on OneDrive. Click on the + New step > Create file. (under the OneDrive connector)
  • Set the below properties with the respective properties. Such as:
    • Folder Path: Set root (/) or provide a folder path.
    • File Name: Select ‘Employee Name’ with ‘Employee ID’ from the dynamic content as a file name with the ‘.html’ extension.
    • File Content: Select ‘Output‘ from compose action.
Power Automate Convert Microsoft Forms to PDF
Power Automate Convert Microsoft Forms to PDF
  • To convert the created file into a PDF format, click on the +New step > convert file. Set the File as Id and the Target type as PDF.
Microsoft Forms to PDF without Premium Actions in Power Automate
Microsoft Forms to PDF without Premium Actions in Power Automate
  • Finally, we will add another action to create this PDF file in a specific SharePoint document library. Click on the +New step > Create file (under SharePoint connector). Set the below properties as below:
    • Site Address: Provide the SharePoint site address
    • Folder Path: Specify a specific Sharepoint document folder path
    • File Name: Select the File name from the ‘convert file’ dynamic content
    • File Content: Select the File content from the ‘convert file’ dynamic content
Convert responses from Microsoft Form to PDF in Power Automate
Convert responses from Microsoft Form to PDF in Power Automate

That’s it! Now save the flow and test it. Click on Save > test > Manually > Test. For testing purposes, submit the form with responses.

See also  How to Use Power Automate dayOfWeek Function?

We can see, once the form is submitted form will be converted to PDF format and saved into the specified SharePoint document library folder as shown below:

Power Automate Create PDF from Microsoft Form
Power Automate Create PDF from Microsoft Form

Once you click on the PDF file, the data will be visible as shown below:

Create PDF when a Microsoft Form is submitted via Power Automate
Create PDF when a Microsoft Form is submitted via Power Automate

This is how to create PDF when a Microsoft Form is submitted via Power Automate.

Conclusion

From this Power Automate tutorial, we learned how to create a Microsoft Form from the Forms and how to create a pdf from the form when a response is submitted via a flow.

You may also like the following Power Automate tutorials:

  • This is awesome!

    How do I attach this pdf that was created, to an email? I created a feedback form, and each response would need to be attached to an email, and get emailed to 3 different people.

  • >