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 / Excel condition format...
Power Automate
Suggested Answer

Excel condition formatting of text color with power autoamte

(1) ShareShare
ReportReport
Posted on by 60

Hi!

I need to run a flow in Power Automate that generates a new Excel file with some data. In this Excel sheet, I would like to control that if a value is, for example, below 100, the text should be colored red. Is there any way to control this in Power Automate?

Thank you in advance for your help!

Categories:
I have the same question (0)
  • Suggested answer
    trice602 Profile Picture
    16,164 Super User 2026 Season 1 on at
    Hi,
     
    I haven't tested this directly but I know Office Scripts can do this.  So here, in your cloud flow, after the file has been created, you can run a cloud action run Office Scripts and run this code.  
     
    function main(workbook: ExcelScript.Workbook) {
        let sheet = workbook.getActiveWorksheet();
        let range = sheet.getRange("A:A"); // Select the entire column A
        let values = range.getValues(); // Get all values in column A
    
        // Loop through each row in column A
        for (let i = 0; i < values.length; i++) {
            let cellValue = values[i][0]; // Get the value of the current cell
            let cell = range.getCell(i, 0); // Get the cell reference
    
            if (typeof cellValue === "number" && cellValue < 100) {
                cell.getFormat().getFill().setColor("red"); // Set background color to red
            } else {
                cell.getFormat().getFill().clear(); // Clear formatting for other cells
            }
        }
    }
    
     

    ------------------------------------------------

     

     

    ⭐ If this was helpful, please like and check the box below "Does this answer your question" to help others find this too!

     

     

    Always glad to help! 💯💯💯💯💯

     

    Tom

     

    Follow me on LinkedIn - Thomas Rice, PMP | LinkedIn

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
Vish WR Profile Picture

Vish WR 873

#2
Valantis Profile Picture

Valantis 820

#3
Haque Profile Picture

Haque 505

Last 30 days Overall leaderboard