Can Uipath highlight rows?

Hi, Is there a way to highlight rows using uipath? I oni know uipath can highlight elements on screen.
Im using add data row to build the data table. I would like to highlight the whole row if one of the if condition is false. is there any way i can go about with it?

Thank you xoxo

Hi @sangasangasanga

Could you specify what do you mean by “highlight rows” in this context?

Do you mean whether it is possible to highlight the rows in the output Excel file?

If so, I would add additional column to the data table that would keep the flag given by the IF statement.
Then, I would execute the macro on the output Excel file that would apply conditional formatting based on that flag.


Hi, I don’t really get you. Could you explain it abit more?

Of course.

First, I don’t think it is possible to save the entire data table to an Excel file together with any formatting.
This means that any highlighting must be done afterwards (after the Write Range activity).
There might be some custom activities around that maybe allow saving on a row per row basis with customer formatting included, granted you are using the Excel Scope and not a simple Write Range activity.

However, if you are using a simple Write Range activity, you can simply add a column to your Data Table that will store ‘True’ if you want to highlight the row and ‘False’ if you don’t.

Then, after your save action is done, you can execute a VBA code on the same file to add the conditional formatting that will highlight the rows based on the Highlight Column value, either True or False.

I understand it is a bit complicated approach, but I cannot see a simpler way.


@loginerror Is it possible if i use append range instead?

I added another column but how can I do this?

Yes, you could first append range and then use Invoke VBA activity within the same Excel Scope. You could also try to navigate the menus in Excel to add the conditional formatting manually :slight_smile:

As to writing a value to the column, you need to do this when your before mentioned IF condition is false. By this point you assign the value of the data table column to either True or False.

If all happens within a For Each Row activity, do it like that with an Assign activity:
row.Item("yourColumnName") = "True"

needs a vba file. But idk how to code it as I have never used it before

Okay, i did like you said

How can i go about with this?


This will require you to do some research and try and error, but I can help you to start :slight_smile:

See the attached example for a working solution: (8.2 KB)

What you will need to adapt is the target range and the color of the highlight in your script. You can do that by editing the .vbs file in the notepad (or any other text editor, I use Notepad++).

As far as getting the code yourself, you can google about recording macros in Excel. You can then examine it and adapt it from there :slight_smile:

1 Like

@loginerror I have tried your solution however, I am getting an error.