web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Reading data from e-ma...
Power Automate
Answered

Reading data from e-mail table and then updating Excel file

(0) ShareShare
ReportReport
Posted on by

Hello,

 

I'm trying to build a flow that counts comments from a table distributed daily via email (example below):

Picture_1.png

The idea would be to count rows where comments were provided (total variable value) and then look for some other words than "Reporting Available" (missing variable value). By dividing the missing by the total I would have a fault ratio (ratio variable).  

 

Having that in place solution should be adding rows to a table each time when e-mail arrives (picture 2).

 

Picture_2.png

 

I have stuck with counting the occurrences within the table. Any ideas on how to move-on are more than appreciated. 

 

Categories:
  • Caspar_Rubin Profile Picture
    831 on at

    Hey,

     

    there might of course be better or easier ways to do this but I would do it like this:

     

    Caspar_Rubin_7-1662976471183.png

     

    I created two Excel files. Excel1.xlsx and Excel2.xlsx. Make sure you actually make tables out of your data under the "Insert" tab, click on "Table". If you do not do that, the Excel actions won't be able to get your data!

    Caspar_Rubin_1-1662975518614.png

     

    My tables are both called Table1.
    So Table1 in Excel1.xlsx is the table with all the comment stuff, and Table1 in Excel2.xlsx is the table with the date & percentage.

     

    Caspar_Rubin_2-1662975569147.png

     

    Now, the flow:

     

    1. Recurrence trigger once a day
    2. List rows present in a table action and point it towards Table1 in the first Excel (Excel1.xlsx).
    3. Initialize two new variables. ReportingAvailable and ReportingNotAvailable, both as Float, not Integer.

      Caspar_Rubin_4-1662975856380.png

       

    4. Add an Apply to each action and use the Dynamic content "value" from the List rows present in a table action.
      First, check with a Condition action if the Comments (dynamic content) is equal to Reporting Available.
      If yes, Increment the ReportingAvailable variable by 1 by using the Increment variable action.
      If no, add another Condition action and check if the Comments is not equal to "".
      If that Condition is yes, then Increment the second variable ReportingNotAvailable.

      (If you want to count empty values towards the percentage as well, you can just remove the second Condition and put the second Increment variable action into the first If no...)

      Caspar_Rubin_5-1662976110642.png

       

    5. After that, add the Current time action to get todays date and after that, use the Convert time zone to convert the Current time dynamic value to your time zone and format of your liking.
      For example I go from UTC to UTC+1 and format it like this: dd.MM.yyyy

    6. For the last step, add a Add a row into a table action and point it towards Table1 in the second Excel (Excel2.xlsx)
      For Date, you use the dynamic value from the Converted time action.
      For Missing data, you use the following Expression:

      mul(div(variables('ReportingNotAvailable'), variables('ReportingAvailable')), 100)

      Don't forget to add the % sign after the Expression. 😃

      Caspar_Rubin_6-1662976428836.png
       
       

    let us know if this works,

    cheers

     

     

     

     

  • barp21 Profile Picture
    on at

    Thanks, @Caspar_Rubin  for this detailed explanation. I guess I haven't pointed out this as strong as I should but the table with data is a part of the e-mail (the table is part of the HTML mail, not an attachment). So the trigger to this action would have to be an e-mail and then there is a challenge of converting mail to excel and then following the actions described you.

  • Verified answer
    Caspar_Rubin Profile Picture
    831 on at

    Hey, 

     

    I might be a little off here but what if you take the content of the E-Mail and just simply check how many times "Reporting Available" occurs in the E-Mail. And then do the same for "Reporting Not Available".

    I don't think we need to do anything with the table inside the E-Mail, right?

     

    1. When a new email arrives trigger
    2. Html to text (preview) action with the Dynamic content Body from the trigger
    3. Initialize a new variable called newLine as a String and in the Value just press Enter key once.
    4. Then use a Compose action to split the E-Mail into an array delimited by newLine
      The Expression would be: 

      split(outputs('Html_to_text')?['body'], variables('newLine'))

      Caspar_Rubin_0-1662983618820.png

      The above would result in the following Output in the Compose SplitUpEmail:
      When you scroll down, you can see that how the E-Mail was split into different values. Every row is a value. 

      Caspar_Rubin_1-1662983823864.png

       

      We now just have to loop every value and count how many times Reporting Available and Reporting not Available occurs in the array.

       

    5. To do that, Initialize another two new Variables. ReportingAvailable and ReportingNotAvailable, both Float without any Value.
    6. The Apply to each action looks almost the same as before. We just loop the Outputs Dynamic content from the Compose SplitUpEmail action and check with two Conditions if the value (Expression: item()) is Reporting Available, and if not, if it is Reporting Not Available. If it's true, we increment the related variable by 1.

      Caspar_Rubin_3-1662984148152.png


      After the Apply to each, we can then simple add the steps where we add a new Row to the Excel table with Date & Percentage.

      The Formular / Expression is still the same:

      mul(div(variables('ReportingNotAvailable'), variables('ReportingAvailable')), 100)

      Caspar_Rubin_6-1662984355863.png

      cheers



       

  • barp21 Profile Picture
    on at

    It works perfect @Caspar_Rubin , thanks for all the effort put in place to look for a solution and explain it so detail. 

  • barp21 Profile Picture
    on at

    I have one more question here to make the solution even more effective. How I can cut from the e-mail body which I receive in the step "HTML to text" to evaluate not the whole e-mail but only a part of it which is staring after a given sentence like "APO BW" for example?

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the July Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Automate

#1
11manish Profile Picture

11manish 227 Super User 2026 Season 2

#2
David_MA Profile Picture

David_MA 213 Super User 2026 Season 2

#3
Mohsin Ali Profile Picture

Mohsin Ali 151

Last 30 days Overall leaderboard