Export SharePoint Document Library Metadata Information to PDF Using Power Automate

Finally, I have some time in my schedule to resume blogging after a long break! This post is prompted by someone who recently asked how to export metadata information from a library (form library to be specific) to PDF, in a PowerApps group I belong to. I thought this could be achieved in Power Automate by calling MS graph API but it turns out to be simpler with Word Online (Business) actions. I decided to blog about how I did it to help someone out there who might be looking to do the same thing.
So let’s get started!
We are going to use content controls. So Open an empty word document and enable Developer tab if you don’t already have it enabled ( note you can enable Developer Tab using Customize the Ribbon..). Once you have enabled th tab, under the Controls section you can add content controls into your document. Use the control Properties to give the control a friendly name that you will use in the Flow. In our own case, we are going to use Repeating Section Content Control inside a table.

  1. Insert table in your word document with 1 row 3 columns. You can add a row for the table header if you want.
  2. Highlight the row by selecting all the cells, and under Developer Tab, insert Repeating Section Content Control into the table. We are using Repeating Section Control because we want the table rows to be dynamic.
  3. Insert Plain Text Content Control into each cell. If you have done step 1 to 3 correctly it should look like this:
  4. Select each Plain Text Content Control and name them as follows using Properties in the Developer Tab: Name, Created, Modified in that order. We are just using the default columns in the library. Note: Use the same name in Title and Tag fields when setting properties.
  5. Now we are done with the template. Save your changes and upload it into a library in your SharePoint site.
  6. Launch Power Automate, create a new blank flow and add Manually trigger a flow action.
  7. Click Next Step and add Get files (properties only). Select your site address from the list, and in the Library, pick the library that your want to export metadata information for.
  8. Add Select action from Data operations. We are using this action to construct JSON array that we will pass into the next action step. Configure key-value pairs like below. We are using default columns in the library here. If you want, you can create more custom columns and add them in the mapping. Note: The name you use as the Key in the map must match the name you give to the Plain Text Content Controls in the template. Since we are using default columns, we have Name, Created and Modified that we used in step 4.

jj      9.  Add Populate a Microsoft Word Template.  Select your site, the document library where the template is and select your template in the File field. On selecting the template, the action loads the content controls within the template. Click Switch to input entire array and select Output from dynamic content . Output parameter is the JSON array output of the Select action.
Switch to input entire array

It should look like this:
1     10. After populating the template, we have to create a document from the template. So add Create file (SharePoint), select site address, the library where you want to keep the docx version and in the File Content select Microsoft word document from dynamic content.
1    11. Add Convert Word To PDF , then add Create file actions and configure them as shown below
 12. In the Create file 2 step, select PDF Document from the dynamic content. 

Now it's time to test. Give your flow a name and save your changes. Click Test > I'll perform the trigger action. If everything works fine you should see the pdf version of the ExpenseReport. 

Note: If you open the generated docx version of the document in word online, you won't see the content of the content controls. You have to download.

Generated PDF document. My library has two documents.


  1. This is really good, i love this content also visit Google Search Api. Thanks for sharing.

  2. Nice reading, I love your content. This is really a fantastic and informative post. Keep it up and if you are looking for Software Development Company In Abu Dhabi then visit Apps Stage


Post a comment

Popular posts from this blog

Generate Word Document From A SharePoint List Item Using Microsoft Flow

Calling Microsoft Graph API from an Angular 5 Single Page Application (SPA)

Creating SharePoint Framework Client Web Part and solving the challenges with _RequestDigest Token value using React