Condition help

I have a flow that executes an excel application scope, refreshes the file and reads cell A2. The output of A2 is a variable (type genericValue). After is the decision, where I need help. If there is data in cell A2 I would like it to continue to the attached sequence. However if there is no data in cell A2 I would like it to stop. Below is how I have the condition. When I test with a file with no data in cell A2 I get the below error.

Given the error message, I would assume A2 does not contain any data. I recommend checking that first and then pulling the value.

Please try this conditiom A2.ToString is Null

There is no data in A2. In the output I get three rows execution started, the error and execution ended. On the side of the decision with no data there is nothing (I want it to end there). Is the error normal?

The error is common, but no it should not be happening. Can you attach your .xaml or tell me exactly how you are getting the variable A2?

If I try this I get a condition error.

I think what @vinaynasani was getting at was to write an expression like If(A2.ToString.IsNullOrEmpty = True, nothing, A2.ToString)


  1. Excel Application scope with path to file
  2. in the do, Execute macro that refreshes the file
  3. delay to let the macro run
  4. Read Cell, “Test” (name of tab), “A2”

You should be fine to do either one of these in your decision statement:

A2.ToString.Length = 0

1 Like

@bcarp This should work!!

Gotta be careful though because if A2 is Nothing then .ToString will not work.
Typically, I would use the condition to check the variable before checking if it is empty. Like this:
If(A2 isNot Nothing, A2.ToString.Trim="", True)
So if A2 is Nothing or Empty, it will be True

EDIT: fixed False to True, because you are checking if it = “” or Nothing to be True. Change it to <> “” and False to make it go to False side.



@ClaytonM is right. Go with that!

Yes you are right…the last condition would be the best way to deal

This worked! I tested it with a blank file and a file with data. The blank ended without an error! Thanks for your help @ClaytonM, @bcarp and @vinaynasani!

1 Like

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