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.
- 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.
- 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.
- To copy the link for further use, click on the Collect responses(on the right side) > Copy the link > Open into another tab.
This is how to create a Microsoft Form and copy the link to share it with others.
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).
- 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).
- 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.
- 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.
- 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.
- 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">')
- 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.
- 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.
- 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
That’s it! Now save the flow and test it. Click on Save > test > Manually > Test. For testing purposes, submit the form with responses.
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:
Once you click on the PDF file, the data will be visible as shown below:
This is how to create PDF when a Microsoft Form is submitted via Power Automate.
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:
- Microsoft Flow or Power Automate employee onboarding
- How to call a flow from another flow in Power Automate
- How do I restore removed files in SharePoint with Power Automate
- How to convert word to pdf using Power Automate
- Power Automate copy files with Examples
After working for more than 15 years in Microsoft technologies like SharePoint, Office 365, and Power Platform (Power Apps, Power Automate, and Power BI), I thought will share my SharePoint expertise knowledge with the world. Our audiences are from the United States, Canada, the United Kingdom, Australia, New Zealand, etc. For my expertise knowledge and SharePoint tutorials, Microsoft has been awarded a Microsoft SharePoint MVP (9 times). I have also worked in companies like HP, TCS, KPIT, etc.
How to change the orientation of PDF.
Hi! I have the same question. How I change the orientation of the table displayed in PDF?