In this guide you’ll learn how to export a document to a PDF using Power Automate.
For this specific example we create a flow that exports a Power BI report to PDF once a day and automatically sends it in an email as an attachment.
It’s also important to note that in this example we are using Power Automate to convert a Power BI report to PDF. You can easily convert other document types and save them to another destination like Dropbox, Google Drive, OneDrive, or any platform supported by Power Automate.
Prerequisites
Before starting, please make sure the following is in place:
- Appropriate permissions to publish Power BI report. <<<<<<< Updated upstream
- Muhimbi PDF Converter for Power Automate full or free trial subscription. =======
- Muhimbi PDF Converter for Power Automate full or free trial subscription.
Stashed changes
- Appropriate privileges to create Microsoft Flow.
- Working knowledge of Microsoft Flow.
Publishing Power BI Reports to Web URL
To publish Power BI Reports to Web URL, perform the following steps:
- Navigate to a report in your workspace that you can edit, and select File > Publish to web.
- Review the content on the dialog, and click Create embed code button as shown in the following dialog.
- Review the warning, shown in the following dialog, and confirm that you are fine to publish the data in the public domain. If you agree with this, click Publish button, else click the Close button.
- If you click Publish button in the previous screen, you will be given a public URL. You can copy the topmost URL, which will be the public URL, which we will use later in the Flow.
You have now successfully published the Power BI report to a Web URL.
Using PowerAutomate to Power BI Reports to PDF
- Login to Microsoft Flow and select the My Flows tab. Navigate to New Flow > Scheduled cloud flow.
- In the Build, a scheduled cloud flow, enter the Flow name, and a suitable starting date and time. In the Repeat every box, specify how often you want the Flow to run. For example, specify 1 under Interval and day under Frequency if you want the flow to run every day. Click Create button.
A new Flow is created. Select + New step, add an action, and then type Muhimbi into the search box to search for all actions related to Muhimbi PDF Converter. Select the ‘Convert HTML to PDF’ action.
Configure the ‘Convert HTML to PDF’ action by pasting the URL obtained from the Power BI Publish to Web URL. Update the other parameters as per the screenshot below.
- Select + New step, and select Office 365 Outlook – Send an email (V2) action. Configure this as per the screenshot below.
- Publish and test the Flow by clicking the Test button.
- You should now receive an email with the Power BI report as a PDF attachment.
Frequently asked questions
1. When you use Publish to web, can the report or visual be viewed by anyone on the Internet?
Yes anyone on the internet can view the report, there is no authentication used when viewing these reports. Only use Publish to the web with reports and data that anyone on the Internet (unauthenticated members of the public) should be able to see. This includes detail level data that is aggregated in your reports. Before publishing this report, ensure you have the right to share the data and visualizations publicly. Do not publish confidential or proprietary information. If in doubt, check your organization’s policies before publishing.
Workaround: The URL generated by Publish to Web Power BI features cannot be guessed unless it is physically shared.
2. My report has multiple pages, which page does it Convert?
It Converts the first(default) page.
Workaround: If you want to convert a different page, then just append &pageName=ReportSection2 at the end of the URL, where 2 is the page number. For more details see the link.
3. Does the PDF capture refreshed data?
Yes, it captures refreshed data. Data refreshes are automatically reflected in your embedded report or visual. It can take approximately 1 hour for refreshed data to be visible from embed codes. You can disable automatic refresh by selecting do not refresh on the schedule for the data set used by the report.