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 Platform Community / Forums / Power Automate / Take filtered data fro...
Power Automate
Answered

Take filtered data from excel which stored in sharepoint and put in email body

(0) ShareShare
ReportReport
Posted on by 176

Hello,

 

I have project to build one power automate flow, where in Sharepoint site I store excel file; Excel contain example data below:

VendorIDVendor nameArticleArticle nameQuanityDataStatusDifference
AAAA123aaaa1010OK0
AAAA234bbb88OK0
AAAA345ccc11OK0
BBBB123aaaa55OK0
BBBB345ccc23missing-1

 

Is it possible, that after some automatic or manual trigger, system check the excel file and if for vendor X all lines have status OK, then system will send email to vendor, where in email body we can put html table like this below:

VendorIDVendor nameArticleArticle nameQuanityDataStatus
AAAA123aaaa1010OK
AAAA234bbb88OK
AAAA345ccc11OK

 

AND if vendor X contain one of the lines not OK, then system don't send any email.

Does exist any possibility create such power automate flow for this process?

Categories:
I have the same question (0)
  • rzaneti Profile Picture
    4,262 Super User 2025 Season 2 on at

    Hi @slvedva ,

     

    I recently wrote a blog post with a solution very similar to your use case (group Excel records by a specific column, create a filtered HTML table and send it by email). The only difference is that it does not check for a status column to be equals to 'OK', but it can be easily integrated to the flow 🙂

     

    Here is the post: http://digitalmill.net/2023/10/11/how-to-send-notifications-from-multiple-excel-records-to-the-same-email-with-power-automate/ 

     

    If this approach makes sense for you, let me know and I help you to include the steps needed to filter only the records with status = OK. 

  • slvedva Profile Picture
    176 on at

    Hi @rzaneti 

     

    I checked your post and tried flow and YES, it's very similar, what I want. Just look like 2 things under question:

    1. How to control by status, which I have?

    2. Is it possible to create this html table a little bit nicer?

    Thanks!

  • rzaneti Profile Picture
    4,262 Super User 2025 Season 2 on at

    Hi @slvedva ,

     

    Sure!!

     

    Filtering status

    To match to your use case, I took the same table from the blog post example and included a 'status' column, containing both 'OK' and 'missing' values:

    rzaneti_0-1697145957790.png

     

    I didn't need to add any additional action to the flow design, but I included a 'Filter query' in the Excel action, to return only those rows which status is ok:

    rzaneti_1-1697146020413.png

     

    Just for clarification, we are taking the column name ('Status'), using an equality operator ('eq') and setting the value that we want to use in this comparison, in order to return the records ('OK'). Be careful when writing this statement, as the characters are case sensitive and, as you will be working with strings, you must encapsulate your 'OK' into single quotes.

     

    Styling the HTML table

    To add style to the HTML table allocated in the email body, you will need to use some CSS. As a first step, click in this '</>' icon in your 'Send an email' action:

    rzaneti_2-1697146240865.png

     

    It will change your email body structure to a HTML notation:

    rzaneti_3-1697146273033.png

     

    Now you can add a style block on the beginning of your email body (highlighted in yellow), and insert your CSS formatting inside it (marked in red).

    rzaneti_4-1697146340162.png

     

    I don't know how comfortable you are with CSS, so here go some starter instructions:

    - Your style tag will start with <style> and end with </style>

    - In the email body, you can see some HTML elements, like <p> (paragraph) and <br> (line break). You can refer to these elements in your CSS to style them

    - To style a HTML element, just write the element (without the '<>'), open curling brackets ('{}'), and enter the properties that you want to style

    - Use one line per property and always finish the line with a semicolon 

    - In our example, we are styling some HTML elements that are not displayed in the email body. That's because they are table elements. 'table' matches to the whole table, 'th' matches to the table header (the column titles), 'td' matches to the table fields

     

    Here is the whole style code that I used:

    <style>
    table{
    background-color: #eee;
    border: 2px solid black;
    }
    
    th{
    background-color: #ccc;
    }
    
    td{
    padding: 15px;
    border: 1px solid black;
    }
    
    </style>

     

    About the properties above:

    - background-color will change my element background, setting it to a light gray. I'm using a hexadecimal color reference (#ccc and #eee), but CSS allows you to use RGB codes or even just type the name of default colors (like red or turquoise). 

    - border will set a visible border to my elements. I'm first assigning a thickness to it (1px or 2px), stating that it is solid (could be dashed or any other style) and assigning a black color.

    - padding is used to add some internal space in the element. In my case, I'm adding 5px in each element, in order to make sure that the different table cells are not so close to each other.

     

    Disclaimer: I'm a very bad artist, so the table is still with a bad design. The goal here is just to showcase how to use CSS in the emails 🙂

     

    And here is the final result:

    rzaneti_5-1697146782517.png

     

    (1) The user received only the trainings that have a status equal to 'OK' and (2) the table has a formatting. 

     

    For additional reference to CSS properties, I recommend you to check these links:

    https://www.w3schools.com/css/

    https://developer.mozilla.org/en-US/docs/Web/CSS 

     

     

    Let me know if it works for you or if you need any additional help!

     

    -------------------------------------------------------------------------
    If this is the answer for your question, please mark the post as Solved.
    If this answer helps you in any way, please give it a like.

    http://digitalmill.net/ 

  • slvedva Profile Picture
    176 on at

    Hi @rzaneti 

     

    Additional question in my case regarding these status, I want that system send out this email only if for one unique vendor all lines are OK. If vendor A have 5 lines and all lines are OK, then send email AND if vendor B have 2 lines OK and 1 missing, then system don't send any email.

  • slvedva Profile Picture
    176 on at

    Do you know, is it possible or no, when power automate send the email to specific excel lines, that power automate post some date/time stamp in excel additional column, that when next time run manually trigger, that system don't send again the same message to receiver, which already got message about OK lines?

  • rzaneti Profile Picture
    4,262 Super User 2025 Season 2 on at

    Hi @slvedva ,

     

    Sorry, you are correct: the solution above does not return only the cases which all courses are 'OK'. Let's fix it and also include the 'email sent date' into the table!

     

    Table overview

    I made some small changes in the table to comply to the requirements. As you can see, we have only one user that must receive the email with the courses, as all of its records are 'OK' (highlighted in yellow), and we also have a new column to store the date when we sent the email (highlighted in green):

    rzaneti_0-1697216200735.png

     

    Clear the Filter Query from Excel action

    First, remove the filter query from Excel action, as we will not be filtering out the missing status at this step:

    rzaneti_1-1697216402742.png

     

    Insert a new 'Filter array'

    Right after the existent 'Filter array' action, insert a new one, and at this time, set the following inputs:

    • From: 'Body' dynamic content from the existent 'Filter array' (highlighted in yellow)
    • Left text box: Enter the item()['Status'] expression (highlighted in green and blue)
    • Dropdown: Make sure that 'is equal to' is selected
    • Right text box: Just type 'OK', without quotes (highlighted in pink) 

    rzaneti_2-1697216566897.png

     

     

    Test filters length

    In 'Filter array', we extracted all records related to a specific user from the Excel table. In 'Filter array 2', we extracted all records with status equals to 'OK' from the first Filter array. Now we need to test if the both 'Filter array' actions have the same length. If yes, all records related to the same users are 'OK', and the email must be sent; if not, no action must be taken. 

     

    Right after the 'Filter array 2', add a condition and set the following inputs

    • Left text box: expression to check the length of the body dynamic content of the first 'Filter array' (highlighted in yellow and green). The expression will be length([dynamic_content])
    • Dropdown: make sure that the 'is equal to' option is selected
    • Right text box: same expression from the left text box, but passing the dynamic content of the other 'Filter array' action

    rzaneti_3-1697216881850.png

     

    Allocate actions inside 'If yes' block

    Now take all of the following actions and allocate them inside the 'If yes' block of the 'Condition', keeping the 'If no' empty: 

    rzaneti_4-1697217091441.png

     

    Adding date to Excel table

    Right after the 'Send an email' action, but still inside the 'If yes' block, add an 'Apply to each' action and set the 'Body' dynamic content from the later 'Filter array' as input (highlighted in blue). Inside it, add an 'Update a row' action, and populate it withe the details about your Excel file and table. In 'Key Column' set your id column (see note below), and in 'Key value', enter the expression to capture the id property for each iterated record, which will look like item()['property_name'] (highlighted in green). In 'Email sent at' column, enter an convertFromUtc(utcNow(), 'Eastern Standard Time') expression (make sure to change to your current time zone), which will capture the current timestamp (highlighted in yellow). 

    rzaneti_8-1697218136191.png

     

     

    Note: To make any updates in Excel tables with Power Automate, you must have a Key Column, which will store only unique identifiers to each record (like user id, product code, social insurance number, and so on). If you don't have it in your table, consider include it, as it is a good practice when iterating records (and a requirement to take this approach). 

     

    Output

    Finally, after run the flow, the email is sent to the only user that has all of the records with status equal to 'OK':

    rzaneti_9-1697218224944.png

     

    And the Excel table is updated with the timestamp (considering the 'UTC' timezone):

    rzaneti_10-1697218258482.png

     

    If you want the flow to ignore the cases where an email was already sent, you can include a 'Filter query' in your Excel action to filter it out, or add an additional condition to any of your 'Filter array' across the flow.

     

    Let me know if it works for you or if you need any additional help!

     

    -------------------------------------------------------------------------
    If this is the answer for your question, please mark the post as Solved.
    If this answer helps you in any way, please give it a like.

    http://digitalmill.net/ 

  • slvedva Profile Picture
    176 on at

    Hi @rzaneti 

     

    Yes, it's work very good! Just How to filter out these rows, where Email sent at is empty, I tried like this (Email_Sent_At eq null), but it's give error 😞

  • Verified answer
    rzaneti Profile Picture
    4,262 Super User 2025 Season 2 on at

    Hi @slvedva ,

     

    I was checking some possible causes for this issue. Apparently Excel does not filter columns which names contains spaces. An option to solve it is just to change your column name to 'email_sent_at', or something similar.

     

    If you want to keep the name with the spaces, it is possible to filter out the results by adding an additional 'Filter array' in your second loop:

    rzaneti_0-1697456150505.png

     

    In the example above, I included the 'Filter array 3' between the two existent. It is filtering the outputs from 'Filter array' by comparing the item()['Email Sent At'] (highlighted in yellow) with string('') (highlighted in green), which is a representation of an empty string. If you take this approach, make sure to change the 'From' for 'Filter array 2', as populating it with the 'body' property from 'Filter array 3'.  

  • slvedva Profile Picture
    176 on at

    Hi @rzaneti 

     

    Remember this process, which we builded, that system send notifications with data table based on big excel table, which contain vendor data, article data etc. and if status are OK, then system send confirmation email with table inside and put date/time remark in excel.

    Question: how I can add vendor id and vendor name in the email subject, because this id and name originally exist in this excel table, where we list the rows. Because when I tried put id and name somewhere in "Apply to each 2", I get next apply to each loop. Thanks!

    slvedva_0-1709902848307.png

     

    slvedva_1-1709902870783.pngslvedva_2-1709902918745.pngslvedva_3-1709902969731.png

     

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 519 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 296 Moderator

#3
abm abm Profile Picture

abm abm 232 Most Valuable Professional

Last 30 days Overall leaderboard