Check excel cell value and & use for if activity

Hi everyone,

I could need some help with UiPath. Here is my case:

So far, my RDA downloads several reports for different countries from a business intelligence tool. The report lists all customer numbers for the selected country and the respective order intake figures. However, the number of rows is limited to about 500 in that BI tool. Therefore, I have to check if each report is complete already or if I have to download additional reports (=> if the original report is not complete I can just download reports for each month of a specific country and merge the figures via a pivot table).

In order to find out if a report is complete, I have to compare the total amount of all new orders (cell C4) with the sum of the orders that are really included in the report. To do so, my RDA writes “=C4-SUM(C5:C519)” into cell C520 => if the value of the formula is 0, both figures match and the report is complete. What I would like to implement now in UiPath is a mechanism that checks automatically if the value of C520 is 0 and if that is TRUE, the file should be saved. If the condition is FALSE, the file should be deleted and my RDA should download the figures for that specific country again, but that time for each month individually.

Here is my question: How can I let my RDA check if the value of C520 is 0 and then decide accordingly?

My plan was to use “Read”, then define the output of the “Read” activity as an integer variable (or argument?) and afterwards integrate that variable into an “If” activity. However, I always receive an error description that is related to the “Read” part. Is “Read” not applicable for this case or am I just using it the wrong way?

This is how I was planning to read the cell value:

Which part are you having trouble with? In your screenshot the error(s) are due to your excel document path and sheet name either not being string variables, or being incorrect. I can tell those are the errors because of the blue exclamation point by those inputs.

for the output of read cell, save it as a string variable, i’ll call it str1 for this example. In an If activity, have the condition be: CInt(str1) = 0. Then on the true side you can leave it blank. On the false side you can add in whatever other activities you need to read & process the additional sheets

1 Like

Hi @HolaSoyYo

In Read cell activity take output to string variable like result and after that parse and compare in if the condition it using CInt(result) =0 if this give you boolean true/false accordingly you can proceed.

1 Like

Hi @HolaSoyYo

To calculate the value all the order and comparing with c250

U have to do the following

First create a integer variable sum and assign it to zero

Second create a integer variable index and assign it to 5

Second, use while loop with condition as

Inside the while loop use read cell activitiy,

Specify the
The sheet name and cell value as “C”+index.ToString

store the obtained value in a variable let’s say b

then assign sum = sum+ cint(b)

Then after this increment index by one inside the loop

After exiting from loop

Use another read range activitiy read cell value at C4 and store in variable let’s say c

then create a new integer variable diff and assign

Use write cell activitiy to write diff value in cell C520

After that use if condition

If diff=0
If this is true
In then section do accordingly for report is complete

If it is false,

In else section, do accordingly for that

Hope it helps

Mark it as solution if it helps

Nived N :robot:

Happy Automation :slight_smile::slight_smile:

1 Like

Hi all,

Thanks a lot for your suggestions!
I have tried to use the “Read” activity again and I’ve just found out that the activity itself was not the problem. Apparently there’s a problem regarding the data types…
I always get the error description “Get row item : Int32Converter cannot convert from System.Double”.
I really don’t know what’s the problem. I have also tried to change the data type of the output variable of the Read activity to “GenericValue”, but then my output is a very long number (compare screenshot) although the respetive cell value is 0.


Do you think the reason for that problem is that Cell C520 contains a formula?
I am confused because the cell is defined as “Number” in Excel, so I don’t know why I can’t use the “Read” activity and define its output as integer. Should I give it a try with the double data type? (don’t know how to select it)

Can u share the screenshot of ur workflow @HolaSoyYo

Yes, this is my workflow:

(fyi: “item” is just a variable that I’m using within a loop to go through the different countries. I’ve got a string array with the country names and the for each activity assigns all those countries to “item”)

Thank you in advance for your support!

Here are the properties of my “Read” activity:

Hi @HolaSoyYo

I didn’t work with this formula side in excel

But if u look my steps above , I had calculated the difference and store in a variable called diff and using write cell activitiy I am writing the value there
Where nu have written the formula instead I had written the diff

It will work

Nived N :robot:

Happy Automation :slight_smile::slight_smile:


I believe I have now implemented the exact structure of your suggestion, but I still receive the same error description.

The program always stops here:
(error: “Read Cell: Int32Converter cannot convert from System.Double”)

@HolaSoyYo - the read cell activity should be contained within the excel application scope. Make sure you are using the excel read cell and NOT the workbook read cell. The workbook read range and read cell activities are only able to pull values, they struggle when pulling cells that contain certain formulas.

Now that I think of it, I think they removed the read cell activity from the main uipath.excel.activities pack. In that case, you should use an excel read range activity instead which will give a datatable back as an output. Make sure you only provide the single cell as the range you want to read. Then you can put the following statement within your if statement (assuming your datatable is called dt1): If Math.Round(Cdbl(dt1.rows(0).item(0)),0,MidpointRounding.AwayFromZero) = 0

What the above formula does is takes the number found in your datatable you grabbed from excel read range and converts it to a double variable type. It then rounds it to the nearest whole number. If it is 0, then it will be true and follow the true path, if it is anything else it will follow the false path


It’s working now. I changed the data types to “Double” again and rounded the result of my formula and now it’s alright. Without rounding, I would still get weird, tiny numbers like 0,000000093 as difference between the total value (C4) and the cumulated values (C520). This also happened when I used NIVED’s solution. But now that I’m rounding the result, both ways work.

1 Like

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