cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Regular Visitor

Send e-mail with chart and rows from excel file in One Drive For Business

Hello

 

We plan to sending e-mail with chart and rows from excel file in One Drive For Business.

 

And also need to refresh all query in excel file.

 

Please reply if it is possible.

 

Thank you.

6 REPLIES 6
Highlighted
Community Support
Community Support

Re: Send e-mail with chart and rows from excel file in One Drive For Business

Hi @Euihwan,

 

How do you want to send email with chart and rows from excel file in OneDrive for Business folder?

Do you want to save the chart and rows from excel file in OneDrive for Business into Body of the email or save them as attachments of the email?

 

I assume that you want to save the chart as attachments of the email and save the rows from excel file in OneDrive for Business into Body of the email. I have made a test on my side and please take a try with the following workaround:

  • Add a proper trigger, here I use Flow Button trigger.
  • Add a "Get file metadata" action, specify your chart within File field of "Get file metadata" action.
  • Add a "Get file content" action, specify your chart within File field of "Get file content" action.
  • Add a "Compose" action, Inputs set to following array data:14.JPG

    Note: There is one element within this array data, which is a json data. There are two elements within this json data, the key of first element set to Name and corresponding value set to DisplayName dynamic content of "Get file metadata" action, the key of second element set to ContentBytes and corresponding value set to following formula:

  • body('Get_file_content')?['$content']
    Add a Variables-> "Initialize variable" action, Name set to OriginalArray, Type set to Array and Value set to output of "Compose" action.
  • Add a "Get rows" action, specify your excel file in OneDrive for Business folder.
  • Add a "Create HTML table" action, From set to output of "Get rows" action.
  • Add a "Send an email" action, Body set to output of "Create HTML table" action, Attachments field set to OriginalArray variable and Is HTML set to Yes.

Image reference:15.JPG

 

16.JPG

The flow works successfully as below:17.JPG

 

18.JPG

 

 

Refreshing all query in excel file is not supported in Microsoft Flow currently, if you would like this feature to be added in Microsoft Flow, please submit an idea to Flow Ideas Forum:

https://powerusers.microsoft.com/t5/Flow-Ideas/idb-p/FlowIdeas

 

Best regards,

Kris

 

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Highlighted
Regular Visitor

Re: Send e-mail with chart and rows from excel file in One Drive For Business

Hi 

 

Thanks for your reply.

 

I think more discripsions will be needed.

 

1. I need to get chart from excel file, not from image file. Is it possible? or extract chart image from excel file.

2. If it is possible, I want to write mail body with some words and that chart like below image.

 

20180202_191609.jpg

 

 

Best regards

Euihwan.

Highlighted
Advocate I
Advocate I

Re: Send e-mail with chart and rows from excel file in One Drive For Business

Yes, this is possible. If you use microsoft graph api calls you can generate an image from a graph and it is returned as a base64 string. You can then use that in the body of the email. 

 

https://docs.microsoft.com/en-us/graph/api/chart-image?view=graph-rest-1.0

 

Highlighted
Frequent Visitor

Re: Send e-mail with chart and rows from excel file in One Drive For Business

can you elaborate on how to set up the flow to look at an excel file in sharepoint and pull a specific chart?

Highlighted
New Member

Re: Send e-mail with chart and rows from excel file in One Drive For Business

@v-xida-msft  Thank you, this worked perfect for me but I'm trying to remove the extra colums that got added the @odata.etag and the ItemInternalId , I don't want those to appear in the email.

Highlighted
Helper I
Helper I

Re: Send e-mail with chart and rows from excel file in One Drive For Business

Hi Kris @v-xida-msft 

 

Thank you for this solution. I tried this today, but got an error while initializing the variable. 

Error
Action 'Initialize_variable' failed
Also, the function get rows is no longer available, so i am trying it with get tables. My intent is to get charts/graphs from the excel to mail. 
Can you please help me find a solution.
Thanks.

Helpful resources

Announcements
firstImage

Super User Program Update

Three Super User rank tiers have been launched!

firstImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

firstImage

New & Improved Power Automate Community Cookbook

We've updated and improved the layout and uploading format of the Power Automate Cookbook!

thirdimage

Power Automate Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

Top Kudoed Authors
Users online (6,806)