How to Create PDF from Excel using Power Automate

This Power Automate Tutorial will show you how to create PDF from Excel using Power Automate. Here, I will show you the step-by-step guide to generate a PDF from an Excel sheet using Power Automate.

We recently received a request to create a PDF using an Excel sheet with Power Automate. That means, when a user uploads an excel report to a document library, it will convert the excel report into PDF, store it in a specific SharePoint document library, and remove that excel file from that library.

Create PDF from Excel using Power Automate

Let’s see how to create a PDF from the excel sheet automatically using Power Automate. To create an automated cloud flow on the Power Automate, the following steps are:

  • On the Power Automate, click on Create > Automated cloud flow.
  • Provide a name to the flow and select the trigger ‘When a file is created (properties only)‘ under the SharePoint connector. Click on Create.
Create PDF from excel sheet using Power Automate
Create PDF from excel sheet using Power Automate
  • Now the trigger is added to the flow environment. Provide the mandatory fields such as Site address and library name. Also, assign the folder path where you will upload the Excel files.
  • Next, we will add another action that will retrieve the contents of a file by using its identifier. The contents can be copied and pasted elsewhere, or they can be used as an attachment.
  • Click on the + New step > Get file content. Specify the SharePoint Site address and set the File identifier as Identifier (Select the value from the trigger’s dynamic content)
Power Automate Create PDF from Excel sheet
Power Automate Create PDF from Excel sheet
  • Next, add a condition action to check whether the uploaded file is an excel or not. For that. click on the New step > Condition. Set the properties such as:
    • File name with extension contains .xls
    • Or
    • File name with extension contains .xlsx
See also  Power Automate Remove Characters From String [With Helpful Examples]

Note: Where ‘File name with extension‘ is taken from the trigger’s dynamic content.

Create PDF from excel via Power Automate
Create PDF from excel via Power Automate
  • As per the condition, if the uploaded file contains the specified values (i.e., .xls or .xlsx), then the flow will proceed forward. Inside the If yes section, click on the + add an action > Create file (under the OneDrive connector). Set the action’s properties as below:
    • Folder Path: Set the value as root (/) or specify a folder path.
    • File Name: File name with extension (Select the dynamic content value from the trigger’s output)
    • File Content: Select ‘File content‘ from the get file content‘s dynamic content.
  • Again, add another action under the Create file action i.e., Convert file. Set the File as Id from the Create file’s dynamic content and Type as PDF.
How to create pdf from excel using power automate
How to create pdf from excel using power automate
  • Once the PDF file is created in OneDrive, add another action to create this PDF file in a SharePoint library.
  • Click on the Add an action > Create file (Under SharePoint connector). Provide the values to the mandatory properties such as site address, folder path, file name, and file content. Where file name and file content use the dynamic content values from the Convert file action.
Convert Excel to PDF format via Power Automate
Convert Excel to PDF format via Power Automate
  • Now, add another action to delete the excel file from the SharePoint folder where we uploaded it earlier.
  • Click on Add new action > Delete file. (Under the SharePoint connector). Provide the SharePoint site address and set the file identifier as Identifier from the trigger’s dynamic content.
  • Finally, we will add another action to delete the converted PDF from the secondary storage i.e., Onedrive. Click on the Add an action > Delete file (Under the OneDrive connector). Select Id from the Create file as File value.
How To Convert Excel Sheets To PDF Using Power Automate
How To Convert Excel Sheets To PDF Using Power Automate

Now we can see the entire flow will look as shown below. You can download this flow from here How To Convert Excel Sheets To PDF Using Power Automate.

How to use Power Automate to convert Excel sheet to PDF
How to use Power Automate to convert Excel sheet to PDF

Let’s save the flow and test it to see how it works. Click on Save > Test >Manually > run flow. For testing purposes, let’s upload an excel file in the desired library folder and we can see it will convert that excel file into PDF. Also, we will see it will remove the excel file from the library once it is converted to PDF.

Convert Excel to PDF in Power Automate
Convert Excel to PDF in Power Automate

This is how to convert Excel to PDF in Power Automate.

See also  Power Automate Condition Based on Form Response Example

Conclusion

From this Power Automate tutorial, we learned how to create a PDF from excel using an automated cloud flow.

You may like the following Power Automate tutorials:

>