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

Community site session details

Session Id : 5+EXUycs1ReqdIA/G1l3sX
Power Automate - Building Flows
Unanswered

HTML Table Conditional Format

Like (0) ShareShare
ReportReport
Posted on 9 Nov 2019 17:44:41 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?
I have the same question (0)
  • Ayedaanqalya Profile Picture
    6 on 04 Aug 2022 at 11:46:05
    Re: HTML Table Conditional Format

    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

     

     

  • sgr Profile Picture
    on 29 Jul 2020 at 11:44:44
    Re: HTML Table Conditional Format

    @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

  • v-litu-msft Profile Picture
    on 14 Nov 2019 at 07:38:49
    Re: HTML Table Conditional Format

    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.

  • Anonymous5 Profile Picture
    107 on 13 Nov 2019 at 19:05:07
    Re: HTML Table Conditional Format
    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
    on 13 Nov 2019 at 02:04:55
    Re: HTML Table Conditional Format

    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 11 Nov 2019 at 05:54:23
    Re: HTML Table Conditional Format
    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?

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Telen Wang – Community Spotlight

We are honored to recognize Telen Wang as our August 2025 Community…

Congratulations to the July Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Automate

#1
Tomac Profile Picture

Tomac 786 Moderator

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 724 Super User 2025 Season 2

#3
stampcoin Profile Picture

stampcoin 290 Super User 2025 Season 2

Last 30 days Overall leaderboard
Loading started
Loading complete