Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

Reply
Rajesh1093
Frequent Visitor

Export Power BI Report and embed as image in the body of email using Power Automate/Logic apps

Please follow below steps to Export PowerBI Report as png image and embed it in the body section of the email.  Login to Power Automate or Logic apps in azure to perform the following

 

1. Create a flow as below in power automate and I have used "When a new email arrives" as a trigger for the next step.

Rajesh1093_0-1708678390994.png

2. Export to file for Power BI Reports:

Select the respective workspace, report and export format. In this case we need to select export format as PNG and the page name should be the report section of the page in the PowerBI service and it can be retrieved in PowerBI service.

Rajesh1093_1-1708678648229.png

3. Initialize a variable :

Add this action to your flow, and give any name for the variable and choose "String" as type. Follow the below steps for the value part

3.1- Type "<img src="data&colon;image/png;base64, " alt="GG" />" in the value section.

Rajesh1093_2-1708678946337.png

3.2- Place your cursor between "base64," and " " " in the value section and then click Expression and type ".$content". 

Rajesh1093_3-1708678977988.png

3.3 - Now click dynamic content and move your cursor before .$content and select file content( output from step 2) and click ok , it will be as below. 

Rajesh1093_4-1708679180974.png

3.4- Content will be updated in the value section as below

Rajesh1093_5-1708679286741.png

4. Select Send an email action to send email , and in the body section click on add dynamic content and add the variable which was created in step 3 as below

Rajesh1093_6-1708679536574.png

5. PowerBI Report image will be embedded in body section of the email as below.

Rajesh1093_7-1708680375919.png

 

Happy to help and happy automating 🙂 

 

 

 



 

10 REPLIES 10
yashwant101
Helper III
Helper III

Hi @Rajesh1093,

 

I used the solution that you have provided. Only one problem: The image is not showing. It is coming like this:

yashwant101_0-1712721548127.png

Your help is highly appreciated.

@yashwant101 , is your export format of PBI report is PNG and your variable initialization is png format as in section 2 and 3.1 then it should work fine. 

Hello, I have the same behaviour though everything seems fine (section 2 and 3.1 set you mentioned).

BigJhon
Frequent Visitor

I used a similar solution, the problem I have now is that the image is too big and gets cropped. Any ideas on how to resize the image size in the email body?

Hi @BigJhon ,

 

Can you try resizing your image using the below parameter, and it should be added in the section 3.1 

<img src="data&colon;image/jpg;base64, <base64 output" width="100" height="100" alt="demo image" />

 

lbendlin
Super User
Super User

Note that there is a string length limit on Base64 strings. Your approach will only work for very small attachments.

is there any solution for this because i am taking one matrix visual and it is getting cropped

In Power BI you can concatenate the Base64 encodings for larger images (Power BI has a 32677 character limit for strings). I am not aware of a way to do the same in Power Automate where the string limit is allegedly 131072.

can you tell me more how can i do? the problem is i have created one matrix visual in power BI and exporting it as png and attaching in power Automate using visual ID but the image is not coming completely it is getting crop, please help me if you can do i am stucked on this step.

Make your visual smaller so it fits into the string limit.

Helpful resources

Announcements
Sept PBI Carousel

Power BI Monthly Update - September 2024

Check out the September 2024 Power BI update to learn about new features.

September Hackathon Carousel

Microsoft Fabric & AI Learning Hackathon

Learn from experts, get hands-on experience, and win awesome prizes.

Sept NL Carousel

Fabric Community Update - September 2024

Find out what's new and trending in the Fabric Community.

Top Solution Authors