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 Automate
Unanswered

Adding cell color

(1) ShareShare
ReportReport
Posted on by 3,844 Super User 2025 Season 2

Hi all,

 

I want to can we able to add cell color to excel using Power automation desktop.

Please let me know if anyone knows, In uipath it is possible can it possible in PAD.

 

Regards,

Ahammad Riyaz

I have the same question (0)
  • VJR Profile Picture
    7,635 on at

    Hi @Ahammad_Riyaz 

     

    No readymade action available in PAD to do that.

     

    One backdoor approach is to keep a cell somehwere far in your sheet which is not visible to the user.

    For example in Z1. Fill this cell manually with the color you want.

     

    Then in PAD use "Copy cells" from Z1 

    and "Paste cells" into your destination cell.

     

    Tried this, it works.

     

     

     

     

  • Riyaz_riz11 Profile Picture
    3,844 Super User 2025 Season 2 on at

    Hi @VJR,

    Thanks for your reply,

     

    I was already tried with that method also,

    we need to update excel in that excel color is white so if i use as copy cell and paste method also the value it was getting in white color itself.

    Any alternate solution ?

  • Henrik_M Profile Picture
    2,021 Super User 2024 Season 1 on at

    Nothing built-in.

    You would have to use VBScript.

    Here's a link to get you started: https://devblogs.microsoft.com/scripting/how-can-i-assign-a-background-color-to-cells-in-a-spreadsheet-and-then-sum-those-cells/

  • VJR Profile Picture
    7,635 on at

    Hi @Ahammad_Riyaz 

     

    In that situation, 

    - First read the value of the cell. Store it in a variable

    - Then copy paste the color 

    - Then write back the value that was stored in the variable

  • Highboy Profile Picture
    1,183 Super User 2024 Season 1 on at

    Can be done by running an powershell script (3 lines)...
    This script attaches to an already running excel instance and enables you to manipulate it.
    You only need the powershell script, but the script belows is just a demonstration of what it can do.
    Code to paste into PAD Below the pictures

    Highboy_0-1636713754869.png
    Highboy_1-1636713929777.png

     

    ****************** Copy all below this line ******************

     

    Excel.LaunchExcel.Launch Visible: True LoadAddInsAndMacros: False Instance=> ExcelInstance
    SET Color TO 1
    LOOP row FROM 1 TO 7 STEP 1
    LOOP Column FROM 1 TO 8 STEP 1
    Scripting.RunPowershellScript Script: $'''$xl = [Runtime.Interopservices.Marshal]::GetActiveObject(\'Excel.Application\')
    $sheet = $xl.WorkSheets.Item(1)
    $sheet.Cells.Item(%row%,%column%).Interior.ColorIndex = %color%''' ScriptOutput=> PowershellOutput ScriptError=> ScriptError
    Variables.IncreaseVariable Value: color IncrementValue: 1 IncreasedValue=> color
    END
    END
    Display.ShowMessageDialog.ShowMessage Message: $'''All done''' Icon: Display.Icon.None Buttons: Display.Buttons.OK DefaultButton: Display.DefaultButton.Button1 IsTopMost: False ButtonPressed=> ButtonPressed
    Excel.CloseExcel.Close Instance: ExcelInstance

     

     

  • VJR Profile Picture
    7,635 on at

    If going by a script option, VBA excel macro is the most suitable because it will directly use the Excel Object Model library (same as the parent application "ie; Excel")

     

    - Write a VBA function that accepts parameters like Workbook name, range, color, sheet, etc

    - Just requires 1 or 2 lines of Code to change color (can help with code if necessary).

    - Simply pass the parameters from PAD using "Run Excel macro" action  

  • Riyaz_riz11 Profile Picture
    3,844 Super User 2025 Season 2 on at

    Hi @VJR 

     

    Can u plz send me the steps what should i do.

     

  • VJR Profile Picture
    7,635 on at

    Hi @Ahammad_Riyaz 

     

    Have you tried this from my above post?

     

    In that situation, 

    - First read the value of the cell. Store it in a variable

    - Then copy paste the color 

    - Then write back the value that was stored in the variable

  • Riyaz_riz11 Profile Picture
    3,844 Super User 2025 Season 2 on at

    Hi @Highboy 

     

    Can you send me the powershell code

  • Highboy Profile Picture
    1,183 Super User 2024 Season 1 on at

    Just paste the code from my post to you PAD, you can get it from there.

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

#2
Tomac Profile Picture

Tomac 405 Moderator

#3
abm abm Profile Picture

abm abm 252 Most Valuable Professional

Last 30 days Overall leaderboard