Get file contents of files

Next, get the file contents of the sample files.

PREREQUISITES
If you haven’t uploaded the sample files into OneDrive, unzip them and upload them.
  1. In Power Automate, select + New step.

  2. Search for OneDrive in the search bar.

  3. Choose either your work or personal OneDrive account by selecting OneDrive for Business or OneDrive.

  4. Search for Get file content in the search bar.

  5. In the File field, select the Folder icon to navigate to the WordDocument01.docx file in OneDrive.

    Get file content OneDrive action in Microsoft Power Automate

Convert file to PDF

Now that you have the file content, you can convert the document to PDF.

  1. In Power Automate, select + New step.

  2. Search for Adobe PDF Services in the search bar.

  3. Select Adobe PDF Services.

  4. Search for Convert Word to PDF in the search bar.

  5. In File Name, name your file as desired but it must end with .docx. This extension is necessary for converting documents from Word to PDF.

  6. Place your cursor in the File Content field.

  7. Using the Dynamic content panel, select File content.

    Convert Word to PDF Action in Microsoft Power Automate

Save the file to OneDrive

Once the document generates, save the file back in OneDrive.

  1. In Microsoft Power Automate, select + New step.
  2. Search for OneDrive in the search bar.
  3. Choose either your work or personal OneDrive account by selecting OneDrive for Business or OneDrive.
  4. Search for Get file content in the search bar.
  5. Search for Create file in the search bar.
  6. Select Create file.
  7. In the Folder Path field, select the folder icon to specify where to save the file in OneDrive.
  8. In File Name, name your file as desired but it must end with .docx. This extension is necessary for converting documents from Word to PDF.
  9. In the File Content field, use Dynamic content panel to insert the PDF File Content variable.

Try flow

  1. In the top-left, select Untitled to rename the flow.
  2. Select Save.
  3. Select Test.
  4. Select Manually and then Save & Test.
  5. Select Continue.
  6. Select Run Flow.

In the OneDrive folder, you should now see the converted PDF.

Selected converted PDF document in OneDrive

Part 2: Generate a dynamic document from a template

This next part builds on Part 1 and uses the Generate document from Word template to dynamically merge data into your document.

Review the document template

Open WordDocument02_.docx from your sample files in OneDrive. The Word document contains several different text tags that represent places where data is populated into the document.