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 / HTML Table Conditional...
Power Automate
Unanswered

HTML Table Conditional Format

(0) ShareShare
ReportReport
Posted on by 107
Hi,

I'm using the Transform Data SQL action to produce a table of due dates for upcoming scheduled maintenance. These are based on time since a "last done date". The query is working well to calculate days left until the due date but as a final step I'd like to output this query to an HTML table.

After some other Googling, I've discovered how to insert borders and padding to make this HTML table look suitable for distribution using the Compose action.

As a final touch I would like to add some conditional formatting to the column which shows "days remaining" that will get a color based on how close it is to zero. For example 0-20 days gets red, 21-50 days orange, then yellow, then green, etc. Can this be expressed to Flow after the HTML table is created before pasting to an Outlook email?
Categories:
I have the same question (0)
  • Anonymous5 Profile Picture
    107 on at
    I've continued searching for this type of solution and the closest I've found is on this link:

    https://alextofan.com/2019/02/14/flow-how-to-change-the-style-of-your-html-table-in-flow/

    From my noobie point of view this of course seems pretty intimidating but the end result is just about what I'm looking for.

    Anyone have any experience with this type of conditional HTML table output?
  • v-litu-msft Profile Picture
    Microsoft Employee on at

    Hi @Anonymous5,

     

    You need to change the condition of the original expression of the article, the structure is similar to the following:

    if(and(greaterOrEquals(variables('Number'),0),lessOrEquals(variables('Number'),20)),variables('varStyle').rowStyleLowValues,variables('varStyle').rowStyleHighValues)

    It means if the number is greater than or equals to 0 and less than or equals to 20, return a low value, or return high value.

    And the value you can set in the variable shows in the article.

    Best Regards,
    Community Support Team _ Lin Tu
    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

  • Anonymous5 Profile Picture
    107 on at
    Thanks Lin,

    How would this entry change for a 3-color arrangement? For me I’d like to have critical in red 0-20 days, marginal in yellow and all others just in white.
  • v-litu-msft Profile Picture
    Microsoft Employee on at

    Hi @Anonymous5,

     

    If you want to change three colors, you could use another if expression to instead of the third parameter of first if expression.

     

    if(and(greaterOrEquals(variables('Number'),0),lessOrEquals(variables('Number'),20)),variables('varStyle').rowStyleLowValues,if(and(greater(variables('Number'),20),lessOrEquals(variables('Number'),40)),variables('varStyle').rowStyleMiddleValues,variables('varStyle').rowStyleHighValues))

     

    If the Number is not greater than or equals to 0 and not less than or equals to 20, perform the second if expression.

    Best Regards,
    Community Support Team _ Lin Tu
    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

  • sgr Profile Picture
    on at

    @Anonymous5 , Is this been resolved? I am too looking for some what similar. Want to sent in email. 
    Example i  have table with column name status.  If status is risk then red color, if safe then green color, if warning then yellow .

    can you share screenshot of your solution..

     

    exp.JPG
    emailcol.JPG

  • Ayedaanqalya Profile Picture
    6 on at

    Hi @Anonymous5, 

    I had the same problem but I managed to solve it.

    • it would be best if you created a [SELECT]
    • Move all the Fields there.
    • for the field where you want to change the font color  ( <p style=" font color: add if condition ">name of the column</p>)
    • If ( equals ( the field name, ' value'),'color if','color elas').
    • then on the privouse ( create Html table) use the output of the SELECT, and change the columns to Automatic.
    • add a compos ( 
      replace(replace(replace(replace(replace(body('Name of your HTML table'), '&lt;''<'), '&gt;''>'), '&amp''&'), '&#39;''"'), '&quot;''"')
       
      in the send email add the compose [that has the style of the table] first then compose [has the replace expiration).
       
      hope that helps 
    Ayedaanqalya_0-1659613535167.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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Congratulations to the March Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Automate

#1
Haque Profile Picture

Haque 592

#2
Valantis Profile Picture

Valantis 340

#3
11manish Profile Picture

11manish 284

Last 30 days Overall leaderboard