How can i color the cells in an excel, by the number of the index multiplied?

Hello!

I want to apply two Set Range Color activities to the cells to make the excel looks like Format As Table color rows, so i need to apply this idea to even and odd index of the cells.
For example, the first one to apply for A3:K(index x 2), and the other one for A2:K(index x 2), something like that, but i can’t figure it out how is the syntax to do that.

Can you help me with this please? :smiley: Thank you in advance!

@CristinaAlina

You have to mention Range like this:

“A3:K”+(index*2).Tostring

Where index is integer variable.

1 Like

Hi
Hope these steps would help you
—use a excel application scope and pass the file path of the excel
—inside the scope use a READ RANGE activity and get the output with a variable of type datatable named dt
—use a while loop and mention the condition like this
counter <= dt.Rows.Count-2
Where counter is a variable of type int32 with default value as 0
—inside the loop now use a set range color activity
And in the range mention as ”A1:K”+counter.ToString
—next to this set range color activity use a assign activity like this
counter = counter + 2
Where counter is a variable of type int32 with default value as 2 defined in the variable panel

All these inside the excel application scope

Cheers @CristinaAlina

2 Likes

I did that, but it must be in a while, because just the first 2 rows were colored:
image

It doesn’t work automatically for all the rows. :confused:

I did all these steps, but because i write him the first index in range, in my case A2 for even rows and A3 for odd rows, the colors from those 2 set range color activities are overlapping, because at every iteration it’s starting with A2 or A3:

image

However, i was inspired by your solution, and i came up with this one:

  • with range: “A”+counter.ToString+“:K”+counter.ToString

And the output was:
image

So thank you very very much :blush:

Cheers @Palaniyappan

1 Like

Fantastic
Cheers @CristinaAlina

1 Like

Update: My report had one more additional line colored, to prevent that i came up with this solution:


1 Like

Alternatively, this demo may give you an hint to do so: