Looping on Excel rows to calculate the value of column C

Good morning everyone.

I’m a begginer and I’m trying to check the limits of the program to understand it apropiately. I’m using UiPath Studio

The task is simple, we have an Excel and we just want to do A2+B2 and the result on C2. But avoiding DataTable, looping over all the writed columns of A and B, until there is no data in A or in B, so it has to stop writing.
SUM.xlsx - Microsoft Excel Online

I have the whole process working but, I don’t know why, the error “Read Cell: DoubleConverter cannot convert from (null).” appears.

My read cells activities’ containers are “A”+i_Row , the other is “B”+i_Row, and the last, “C”+i_Row, saving every value on a variable (ValueA and ValueB)

Assign:
ValueAplusB=ValueA+ValueB

To loop I have a int_Count variable, Int 32,
and i_Row , is string
both inicialized in 2

Assign:
count=int_count+1

Assign:
i_Row=(int_count).tostring

Maybe the cause of the whole problem is the use of the while condition I used to stop looping?
Double_ValorA.TOSTRING<>“” or Double_ValorB.TOSTRING<>“”

I know that is not the most efficient way to do the task, just mere practice.

I want to test doing it directly from Excel, and from WorkSheets.

Thanks in advance,

@thealitaxxx,

It’s issue in Activity - Read Cell. You have used Double type variable to store the output of Read Cell and it’s failing when the read cell returns null when the cell being read is empty or don’t have a value.

Solution?
Create an Object data type variable to store the Read Cell output like this.

Now use an If activity to check the value of output variable for null before you try to convert it. If the object is not null, convert the numbers and store the result in C column else break the loop.

1 Like