How to set color or get color from a cell in excel UiPath

A lot of times we work with excel while automating a business process.

While processing the data that is present inside the excel we might need to add some status or comments after processing that data.

We usually do two things either we mark that as completed or we mark that cell with some color to show that as completed.

In this article, we are going to see how we can add color to a cell and get the color from a particular cell.

Let’s jump into the practical implementation of this task.

The input excel data looks like as mentioned below:

excel input

Step1: Drag and Drop an excel application scope activity from the activities panel to the designer panel as shown below:

excel application scope

Step2: Drag and Drop Set Range Color Activity from activities panel to the designer panel as shown below:

set color or get color

Now, let us look at the properties for this activity which inside the excel application scope:

set color or get color

Here:

  • Color- We need to mention the color that is filled in that particular cell or a range.

The input color that we are using in this example is green and we need to mention that like this System.Drawing.Color.Green.

  • Range- In this property, if you want to set the color for a certain range pass the input like this A1:A10 else pass it as shown in the image.
  • SheetName- The name of the sheet where you want all this to happen.

With this we successfully colored the cell A2 as shown below:

excel output

Till this point we set the color of a particular cell.

Now let’s see how we can get the cell color from the excel.

We are using the same excel as input and trying to get the same cell value.

Step3: Drag and Drop a Get Cell Color Activity from the activities panel to the designer panel as shown below:

set color or get color

Let’s look at the required properties for this activity:

set color or get color

Here:

  • Cell- Provide the cell value from which we want to get the color value.
  • SheetName- Provide the sheet name of the excel.
  • color- It will provide the color of that particular cell and cellColor is a variable of type color.

This is the output of above steps:

get range color output

This is how we can set color or get color of a cell in excel.

Happy Learning!

Like this post then let your friends know about this-:

Leave a Reply

Your email address will not be published. Required fields are marked *