powerautomate, documentlibrary, convertwordtopdf,

Convert Microsoft Word Document to PDF using Power Automate

Nov 17, 2020 · 3 mins read
Convert Microsoft Word Document to PDF using Power Automate
Share this

Have you faced a situation where you want to convert a Microsoft Word document in SharePoint Document Library to PDF using Power Automate? When you check the Power Automate Actions, you see that there are no actions available (at least when I write this blog) which converts Microsoft word document to PDF from SharePoint. But fortunately for us, the connector is available for OneDrive for Business files. So our approach would be something like below

Approach

  1. Get the file from SharePoint Document library.
  2. Copy the file to a Temporary Folder in OneDrive for Business.
  3. Convert the Word file to PDF using Convert File action of OneDrive.
  4. Copy / Create the converted file from OneDrive to your SharePoint Document library.
  5. Delete the word file and PDF file from your temporary folder of OneDrive for Business.

1. Get file from SharePoint Document Library

In my case, my trigger for the Power Automate was For a selected file in SharePoint document library. Once I initiate Power Automate, the file would be read and the process continues Get File from SharePoint Document Library

2. Copy the file to OneDrive

Since SharePoint doesn’t have the Action component for converting word to PDf, we have to copy the file to a Temporary folder in your OneDrive. Copy File to OneDrive

In the above section,

  1. This control will get the properties since Create File of OneDrive needs File Content.
  2. This component gets the File Content
  3. This will create the file in your OneDrive in a folder called Temp Folder

After completion of the above steps, you would have a Word document created

3. Convert Word file to PDF

Convert Word to PDF

Here you use Convert File control of OneDrive for business through which you can convert any word file which is there in your OneDrive.

At the time of writing this blog, Convert File Action is currently on Preview. But it will serve the purpose without any issue

4. Created the converted PDF file in SharePoint Document library

Once the file is converted, you can create the converted file in your SharePoint document library. Created Converted PDF in SharePoint Document Library

The above steps would have created a PDF file in your document library

5. Delete the file form OneDrive Temp Folder

Please make sure you are deleting the Temp file which you had created in your OneDrive. Delete Temp File from OneDrive

You can also delete the original word document if your business process requires that so that original word document which is there in the library will not be available.

Complete Power Automate Process

Following is the complete Power Automate for the conversion process. You can see that number of controls for the simple conversion is on a higher end which is due to the unavailability of the Convert File control in SharePoint. If your conversion process needs to be done in your OneDrive, you would hardly have 3 Action Components in your Power Automate. Convert Word to PDF - Complete Power Automate Process

Photo by Drew Coffman on Unsplash