Create PDF from Microsoft Forms via Power Automate

Loading

Requirement: 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. Create a Microsoft Form within the Forms and convert a PDF from the Microsoft Forms when it is responded to. After that, save that PDF file into a specific document library.

Create a Microsoft Form

Generate surveys, quizzes, and polls using Microsoft Forms, 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

  • The Microsoft Form environment will be redirected, 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

  • 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, add different types of questions based on the Employee Health and Travel Declaration.
  • Here, is the overview of the Microsoft Form that have created.

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

Create Flow to convert the Microsoft Form to PDF

As per the requirement,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 Power Automate

  • Next, 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

  • Once the flow gets the response details, 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

  • 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

  • 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

  • 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

  • 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

  • Finally, 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

  • That’s it! Now save the flow and test it. Click on Save > test > Manually > Test. For testing purposes, submit the form with responses.
  • Once the form is submitted form will be converted to PDF format and saved into the specified SharePoint document library folder 

Power Automate Create PDF from Microsoft Form

Once click on the PDF file, the data will be visible

Create PDF when a Microsoft Form is submitted via Power Automate

Leave a Reply

Your email address will not be published. Required fields are marked *