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

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
    15,402 Super User 2025 Season 2 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

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

#2
Tomac Profile Picture

Tomac 364 Moderator

#3
abm abm Profile Picture

abm abm 243 Most Valuable Professional

Last 30 days Overall leaderboard