Hello how can I check or read an empty book?
In the process I make several filters and sometimes the excel that I generate has no records.
I want to check if rows > 0, to follow other steps and finish, but it gives me this error.
Read Interval Book:: Object reference not set to an instance of an object.
Give Excel full path in the workbook activity
You can try with Excel application scope Read range activity
Check out the below image @Aguirre
To avoid this error, first check if the datatable is initialized or not and then check the row count.
Hi, I’ve tried that and it fails. He gives me the following message:
Get Table Range: Could not retrieve table range.
The excel exists, it is in an accessible path, since if I have values, it reads it without problem
I have carried out a test with records in excel and well, but without error records.
The problem is that to get there, I have to read the excel and save it in a datatable. and it gives me an error when reading an empty excel
You the Read Range in the Try catch activity to avoid this error
Understood, then putting the Read range activity inside the Try part sounds like a good solution in this case. You can initialize the DT in the catch part or simply set some boolean flag and use it later while checking the number of rows.
It can be used as a solution, but then you can not read a table without values?
Hi, I don’t quite understand your proposal, can you put a screenshot?
If there is no data in the excel it will go the Catch and it will assign as
So you will avoid the error @Aguirre
After that you check the Dt count using if activity
So Try section has the Read range and if it fails - it will to catch section and assign the boolean as TRUE and later you can use this boolean as you wish.
I have tried this solution and it works for me.
Thank you very much to all.
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.