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

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Automate
Unanswered

Email Counter

(0) ShareShare
ReportReport
Posted on by 108

Hi,

I am looking to build a flow that checks and counts how many emails with a specific subject arrive in my outlook inbox each day. Then at the end of the day an email is sent out to specific recipients on how many emails with this subject have arrived in the inbox.

I know there is an action called "When a new email arrives" and there is a scheduled flows to help with this.

Would anyone be able to show me how I can go about setting this up?

Categories:
I have the same question (0)
  • Caspar_Rubin Profile Picture
    831 on at

    Hey,

     

    First, you need to decide where you want to temporarily save the counter data...

    My suggestion: a SharePoint List or an Excel File that's saved inside your OneDrive.

     

    If you want to do it with an Excel file, create a new one inside your OneDrive, give it a name (mine is called ExcelCounter.xlsx) and create a table with one column called Counter.

     

    Make sure you create an "actual" table (Insert - Table)... Mine is called Table1.

     

    Caspar_Rubin_2-1667219927171.png

     

    The fist Flow

     

    This Flow writes a counter into the Excel file.

    It adds +1 each time an email with the desired string in its subject arrives in your Mailbox.

     

     

    Caspar_Rubin_1-1667220583621.png

     

    Explanation of the 3 actions:

     

    Select the Trigger "When a new email arrives (V3), click on Show advanced options and input your desired String that the subject field should be filtered for. In my case, I chose ABC123:

     

    Caspar_Rubin_2-1667220598078.png

     

    After that, get the counter number that's already in the Excel File using the "Get a row" action.

    Point it towards your Excel file, the Key Value is always going to be 0. That's not the number / counter, it's the first row under the heading row. Second row would be key value 1, etc.

     

    Caspar_Rubin_4-1667220909231.png

     

     

    Now the last step, we update the value. We have to add 1. Use the "Update a row" action. Again, we want to update the value in the Key Value row 0.

     

    Caspar_Rubin_5-1667220982276.png

     

     

    In the Counter field, enter the following Expression:

     

    add(int(outputs('Get_a_row')?['body/Counter']), 1)

     

    Now everytime a E-Mail arrives, that has ABC123 in its subject, the counter will add 1. 

    The second Flow

     

    This flow runs once a day. Let's say at 06:00 PM. Therefore, select the Scheduled Trigger.

    Be careful with the timezones here, you might have to select a later time to trigger at 6:00...

     

    Caspar_Rubin_6-1667221209929.png

     

    The Flow:

     

    Caspar_Rubin_9-1667221416340.png

     

     

     

    Once again, we're using the "Get a row" action to get the counter. We then use the Send an email (V2) action to send the E-Mail. In the body, you can then select the Dynamic value Counter from the "Get a row" action.


    After sending the E-Mail, use a Update a row action to reset the Counter back to 0 for the next day...

     

    let us know if this works for you - cheers,

    caspar

     

  • Aazza Profile Picture
    108 on at

    Hi @Caspar_Rubin 

    That works great thank you.

    Following up from this though, how would i then go about saving each day's totals into an excel spreadsheet which is stored in SharePoint. As I'd like to have each day's total in a spreadsheet which I can also attach to the email.

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 501 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 323 Moderator

#3
abm abm Profile Picture

abm abm 237 Most Valuable Professional

Last 30 days Overall leaderboard