Read range on empty workbook

I find that attempting to use file Read Range on an empty workbook is faulting. Is this to be expected? Seems rather dumb if so.

I’ve found that I need first do a Read Cell on the first cell in the sheet. If the result is not null or empty I know I have data and can then do Read Range.

Like I said, dumb. Unless there’s some logic that is above me.

ddk

1 Like

Hi Daniel,

No, this is not the expected behavior. Could you please provide the UiPath.Excel.Activities package version?

Not the Excel Read… Range. It’s the Workbook version.

The Workbook activities are also in the Excel.Activities package.

Hi @rabbit_rebozo,

@ovi
Yes you are right you can use the same step to find sheet is empty or not.

Note: The only problem is if the records start from some other position its difficult to find sheet is empty or not.

Regards
Arivu :slight_smile:

We build the workbook so we know what’s where. We just don’t always know beforehand if there’s anything in it.

Might be better to surround it with a Try/Catch so it will continue on error, then before you use the data check if it has data, like [ dt isNot Nothing ]

Read Cell method like Ovi said could give you inaccurate results.

3 Likes