Check for empty excel file

I need to check excel file is empty.
Maybe I’m doing something wrong, but I will explain you my idea.

I’m counting the rows in Excel.
My variable is rowCount (int32) that store the total number of rows.
So in my IF condition if it’s below 1 Excel file would be empty.
So he is going to message Empty + my variable converted to string.

But then I realize he start counting from 0.
So my excel file can have only one row, but he will say that he is empty.
Because he start to count from 0 at the first row.

I’m trying to figure out how to check for empty file.

Thanks in advance.


Change the if as rowCount > 0

Means you will have one row atlease.
If you need to check other than the header row, then use rowCount>1


My file don’t have header, so if there is atleast one row with information it would be always count in rowCount = 0.

This is the point that sometimes I can have ONLY one row, and the counter would be always 0.

I was thinking something about to count the first cell A1 is it empty string.
If A1 is empty for sure the file don’t contain information and he is empty.

But now I must understand how to check for empty string in specific cell.


In that case you can use Read Cell Value - and check the string is empty or not .

You can check with this in a IF and do what ever you want for the true or false part


Thanks for your proposal.
I do the same with Read Cell activity and check in if statement.
It’s work.
Thanks anyway, I will mark your answer for solution.

1 Like