uipath technical infomation for everyone

Get / set cell color (background color)


Use the Get Cell Color activity to get the cell color (background color). Use the Set Range Color activity to set the color (background color) in reverse. These activities can only be used in Excel Application Scope activities.

Procedure of acquiring cell color (background color)

 

1. Open Excel in the Excel Application Scope activity. Place a Get Cell Color activity inside the Excel Application Scope activity.

 

2. Set the properties of the Get Cell Color activity.

 

Properties Commentary
Cell Specify the cell to get the color.
SheetName Specify the target sheet name.
Color Specify a variable to receive the acquired color. Here, the String variable “strCellColor” is specified.

 

Robot execution result

Procedure for setting cell color (background color)

 

1. Open Excel in the Excel Application Scope activity. Place the Set Range Color activity inside the Excel Application Scope activity.

 

2. Set the properties of the Range Color activity.

 

Properties Commentary
Color Specify the color to set. Here, “System.Drawing.Color.Green” is specified. There are other predefined colors, so try changing the “XXXX” part of “System.Drawing.Color.XXXX” to the color of the color sample below.
Color samples
Range Specify the range for setting the color.
SheetName Specify the target sheet name.

 

Robot execution result