Read Cell for Null and Double Values

I am working with an excel file which in a column has values ​​that when using the “Read Cell” activity must use a double variable according to UiPath. I have my Read Cell activity inside a For each since I want to go through the cell value by cell, however there is a time when there are no more values ​​and UiPath gives me an error since a value marked as “Null” cannot be converted to Double. Can someone give me a suggestion on how I could use the “Read Cell” activity and be able to get both Null and Double values?

I am avoiding using a datatable since I must also use other excel activities to interact with the document.

Hi @JavXult ,

Could you try with this and see if you face the same error?

If(IsNothing(CurrentRow(IndexOrColumnName)) OrElse String.IsNullOrEmpty(CurrentRow(IndexOrColumnName).ToString),0,Convert.ToDouble(CurrentRow(IndexOrColumnName).ToString))

Kind Regards,
Ashwin A.K


Can you try to use UiPath.Core.GenericValue type, as the following?




That helped! Thank you

1 Like

I really appreciate nice solution can you please explain if condition

gv Is Nothing OrElse(Not Double.TryParse(gv.ToString,New Double))
what is orElse here


If we use not OrElse but Or and gv is null, exception will occur, because of null exception of gv.ToString. OrElse is short-circuiting inclusive logical dis-junction. If first condition is true, second condition is not evaluated.

Hope this helps you.


This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.