Hello everyone,
I would like to put a PNG of my data report in email body. Is it possible? If yes, how to do it? When you push data report to certain collaborators, they need read fast and they don't have time to open an attachment...
Thank you in advance. 😉
Thanks @Azim_ahmad8 and @yashjlad for the explanation.
I have configured the power automate flow successfully.
Just one more point to add, i tried Dynamic Content in the email body but it cannot shows my picture, and i have figured out another way to do it:
I copied the statement and paste in the body content, and it works:
The above answer by @Azim_ahmad8 is very accurate. It just needs one change when you initialize the variable, use the text from the image he put and not from what he pasted in the third bullet part. I was making that mistake and instead tried using this:
<img src="data:image/jpeg;base64,@{outputs('Export_To_File_for_Power_BI_Reports')?['body'].$content} " alt=" my file" />
It works perfectly. Thanks @Azim_ahmad8 for the brief explanation.
Hi @Anonymous ,
I found an interesting link that might be related to the answer posted by @Mister_Shaik, this is the link
https://mohitvash.wordpress.com/2020/09/06/power-automate-embed-an-image-in-an-email/
However in this example, the report source is the Sharepoint folder, you can do slight modification on top of this solution,
So Im sharing with you my work around:
1. I set the trigger using "Recurrence" trigger where I set the email will be automatically sent when the time is as specified (eg: 7AM)
2. Then I used "Export To Power BI Reports" to get the report in certain format that I preferred (in my case its .PNG), however you
# Must know at this current stage the image/file exported is in Binary format or base64 format, or other format Im not so sure
# But the point is, its not an image yet (Unless you add the image as attachment than it will work)
# For the case of wanting to include the image directly in email body, you must later add the image using HTML image tag as mentioned by @Mister_Shaik, we can do that using "Initialize Variable" action
3. Add "Initialize Variable" action to your flow, as mention in the link I attach earlier, you should
# first give the name for your variable (later to referred to when choosing the content in final step) like in the example its "ImageTag",
# secondly for the type please choose the string,
# thirdly in the "Value" part please type
"<img src="data:image/jpeg;base64, " alt="alert" />"
# then click between 'base64, ' and '" alt="alert"'
# then click the "Expression" pop up, and in the text box write ".$content"
# then click on the left side of the "." in the ".$content", and click "Dynamic Content"
# then choose your exported report, type "File Content" in the text box
# and press "okay", the end result should be like this
# For each image/file content you should have separate "Initialize Variable" actions
4. Add new action, in the text box type and select "Send an Email",
# first add the email you wanted to send the email to and the subject
# next you should change the body part of the email to be formatted as HTML
# to do so, you should click at the "Send an Email" action tag, and look at the "Body" part and click the "</>" button
# after you click it, the format should be in HTML format, like below
# Then click somewhere in the HTML tag, click "Dynamic Content" and look for "ImageTag" or any other name that you give in step 3
# if the content is successfully added it should look like this,
5. Final step is to save and test your flow, if the flow is okay you should receive an email with the image included in the body of the email. If you encounter any error, debug the issue based on the error raised first and use the setting I mentioned, it should work
Sorry for the lengthy post, hope it is useful for others. If I did mention any wrong step please add in the comment, thanks.
If you use Subscriptions you can choose to include a preview image.
Hi Vincent,
Did you find the answer? it would be great if this is possible.
Hi @Mister_Shaik,
Thanks but I would like to use API "Export To File for Power BI Reports" (.png) by mail without attachement but embed in body Email. Is-it possible ? Or am I have to use to store my .png on sharepoint/sharepointlist and take it everytime ?
Thank you for your time.
Hi @Anonymous ,
If you just want to include a image in your email body, then you can use a img tag with src pointing to the base64 content instead of a link.
<img src="data:image/png;base64,#yourBase64ContentHere" />
I've used this to embed images in many of my flows, and the image can be static like something from a SharePoint library or dynamic, like something from a form/list submission.
Hope this helps 🙂
Kind Regards,
Shaik Sha
________________________________________________________________________
If I have answered your question, please mark the post as Solved.
If you like my response, please give it a Thumbs Up.