Using Flow to convert Word documents to PDFs in just six easy steps
Flow Microsoft 365Converting a Microsoft Word document in SharePoint to PDF is a great way to prevent further editing, but traditionally it was difficult to automate without code or a third-party plugin.
Now, though, Microsoft Flow makes it quite straight forward.
In the below tutorial, I’m going to show you how to create a flow to convert documents to PDF using just six steps (with the help of OneDrive for Business).
I’m going to assume you know how to create flows and are familiar with actions, connections and dynamic content.
Creating the flow
1. In this example, we’ll create a flow from blank and use the ‘for a selected file’ trigger.
2. Then, we’ll enter the details of the site collection and document library that we want to run workflow on.
3. Then, we’ll add a new step for the ‘get file properties’ action. This is where we identify the file to convert. Use the same site address and library name as the previous step and choose ‘FileId’ from the options in dynamic content.
4. Now that we know which document to convert, we need to get the content of the document. To do this, add the ‘Get file content’ action. Use the same site address as before and choose ‘Identifier’ from the dynamic content.
5. Now we need to create the document in OneDrive for Business (you may need to set up the connection if it hasn’t already been set up). For the folder path, navigate to the folder that will store the documents you want to convert. I’m using ‘Files for conversion’.
For the file name, use ‘File name with extension’ from the dynamic content. For the file content, select ‘File Content’ from the dynamic content.
6. Next, use the OneDrive for Business ‘Convert file’ action. Use ‘Id’ from dynamic content to populate the file field. Type ‘PDF’ into the target type.
NB: The ‘convert file’ action doesn’t create a PDF in your One Drive for Business file.
7. Now the convert action file has been added, add a ‘Create file’ action. I’ve used the same site collection and document library as earlier but you can create the convert file in other site collections or libraries.
For the file name, use ‘Display name’ from the dynamic content. For the file content, select ‘File Content’ from the dynamic content.
Converting a document
1. Back in SharePoint, go to the document library that was used to create the flow.
2. Select the document that you want to convert and then select ‘Flow’. From here choose ‘Convert Word to PDF’.
3. Select ‘Run flow’.
4. The flow will run.
5. Your Word document has now been converted to PDF.
Next steps
Now that you know how to convert Word documents to PDF, you can expand this flow to complete further actions, such as email the PDF as an attachment, send notifications, delete the newly created file from OneDrive, or archive the original Word document.