Using Excel Loop Activity and sending blank excel with Headers only

Hello Team,

I am using Excel Loop activity to fetch data in excel file. But if empty excel with only headers is passed, it gives error “Index was outside the bounds of array”

I have used try catch also to catch this error.

Could you please assist if there is way to check initially if the excel is blank or not ?
Is there any way I can get count of data even before going inside loop ?

Thanks In advance.

Hi,

if you are using try catch then exception for blank row will pass execution flow to catch block where you can log or write the exception and then proceed with remaining part of use case

Regards,
Amit Anand

@amit_anand15 : just wanted to check if there is any resolution to above problem in latest AE studio v18.2 patch ?

Can we get the count of records existing in excel before processing ?

Hi,

The issue is resolved in 18.2 release.

Also, in case you want to know the count of records in excel here is the workaround. Import the excel in a data table and then get the number of rows

Regards,
Amit

Hi @amit_anand15 : Thank you for your response.
I am still getting “Index was outside the bounds of array” error in case of blank excel and control goes to exception.

May i know if i am missing anything ? as you said this is resolved in 18.2 patch.

@ameyaprabhune
Even I am getting the same error on 18.2 patch
As @amit_anand15 pointed out, to avoid the error, first import the data table using Import Data Table Activity. Then store the row count in an int argument using Count Row Column Activity.
Then do a conditional check. If Row Count is more than zero, then only run the Excel Loop.