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 / Conditional Formatting...
Power Automate
Answered

Conditional Formatting of Row Values in HTML Table

(0) ShareShare
ReportReport
Posted on by 2

Hi,

 

I have designed a flow which sends emails to the respective users with open items assigned to them.

 

The email is containing values from an HTML table. For table formatting I am using the below CSS code in a compose action. The table is having one day's column which is calculating the days after creating the item. I want to apply conditional formatting only to the day's column so that if the request is created within the last 7 days, then the font should be green, if between 8 to 30 days then the font should be orange and if more than 31 or 30 days the font should be red. I don't have knowledge of CSS or HTML so can anyone please help me how to achieve that?

Below the CSS Code I am using for styling.

 

<style>
table {
 border: 1px solid #1C6EA4;
 background-color: #EEEEEE;
 width: 100%;
 text-align: center;
 border-collapse: collapse;
}
table td, table th {
 border: 1px solid #AAAAAA;
 padding: 3px 2px;
}
table tbody td {
 font-size: 11px;
}
table thead {
 background: #d9291c;
 border-bottom: 2px solid #444444;
}
table thead th {
 font-size: 14px;
 font-weight: bold;
 color: #FFFFFF;
 border-left: 2px solid #D0E4F5;
}
table thead th:first-child {
 border-left: none;
}
</style>

 

 

Thanks and Regards,

 

Note: NO ChatGPT answers please. I have did that already.

Categories:
  • abouchaalaBAIT Profile Picture
    932 Moderator on at

    @AkshayManke 

    abouchaalaBAIT_0-1701095929356.png

    ----------------------------------------------------------
    If I have answered your question, please mark your post as Solved. 🆗✔️
    If you like my response, please give it a Thumbs Up. 👍
    You can accept more than one post as a solution.

  • AkshayManke Profile Picture
    2 on at

    Attaching flow snaps as below for reference.

    1.JPG2.JPG3.JPG

    4.JPG

  • Verified answer
    AkshayManke Profile Picture
    2 on at

    Got the solution using expression. Below used in the 'Create HTML Table' action and got the expected results. 

     

    if(
     less(
     div(sub(ticks(utcNow()), ticks(item()?['DateColumn'])), 864000000000),
     -3
     ),
     concat(
     '<span style="color:green">',
     div(sub(ticks(utcNow()), ticks(item()?['DateColumn'])), 864000000000),
     '</span>'
     ),
     if(
     and(
     greaterOrEquals(
     div(sub(ticks(utcNow()), ticks(item()?['DateColumn'])), 864000000000),
     1
     ),
     lessOrEquals(
     div(sub(ticks(utcNow()), ticks(item()?['DateColumn'])), 864000000000),
     7
     )
     ),
     concat(
     '<span style="color:#00b050">',
     div(sub(ticks(utcNow()), ticks(item()?['DateColumn'])), 864000000000),
     '</span>'
     ),
     if(
     and(
     greaterOrEquals(
     div(sub(ticks(utcNow()), ticks(item()?['DateColumn'])), 864000000000),
     8
     ),
     lessOrEquals(
     div(sub(ticks(utcNow()), ticks(item()?['DateColumn'])), 864000000000),
     30
     )
     ),
     concat(
     '<span style="color:#c0560f">',
     div(sub(ticks(utcNow()), ticks(item()?['DateColumn'])), 864000000000),
     '</span>'
     ),
     concat(
     '<span style="color:#ff0000">',
     div(sub(ticks(utcNow()), ticks(item()?['DateColumn'])), 864000000000),
     '</span>'
     )
     )
     )
    )

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
David_MA Profile Picture

David_MA 259 Super User 2026 Season 2

#2
11manish Profile Picture

11manish 227 Super User 2026 Season 2

#3
Valantis Profile Picture

Valantis 134 Super User 2026 Season 2

Last 30 days Overall leaderboard