WorkBook Read Range: Index was out of range. Must be non-negative and less than the size of the collection.Parameter name: index

Hello All ,

Whenever I use any workbook activity like read range , read column , etc. I am getting error as “Index was out of range. Must be non-negative and less than the size of the collection.Parameter name: index”.

But , When I used Read range with exact same range parameters within Excel application scope , its working.
Can anybody please help.

Regards,
Akanksha

@pakankshabha

Welcome to our UiPath community.

Could you please help me with screenshot of Workbook Read Range activity. Need to check once how you are passing data to it.

image

receiptColumn is the output of Read Column activity .

If I use same parameters (sheetname , filename , range) within excel application scope. It works

Hi @pakankshabha

I am attaching one workflow which can help you to get the difference between the Excel & Workbook activities Cell Range Property.

Just run/debug the workflow.
IncreamentMonthAsPerSerialNo.xlsx (8.8 KB)
Main.xaml (12.8 KB)

Actually Datatable value starts from 0.
And Normal Row index starts from 1.

Hope this may help to solve your issue
Mark as solution if this helps you and like it :innocent:

Happy Automation :raised_hands:

Best Regards
Er Pratik Wavhal :robot::man_technologist:t4: :computer:

Thank you … In the code , I am not able to see some activity. Can you please send the screenshot how you used it.

Hi @pakankshabha

Just look for the Cell/range property in both activities

Below SS is for Write Cell Workbook Activity
image
image

Below SS is for Write Cell Excel Activity


image

Hope this may help to solve your issue
Mark as solution if this helps you and like it :innocent:

Happy Automation :raised_hands:

Best Regards
Er Pratik Wavhal :robot::man_technologist:t4: :computer:

Thank you. I have tried copying the data which I need to read in some sample excel. I kept the range same. There it worked. As per my observation , this activity of workbook (Read range , read column , write range) is not working if the excel contains pivots n all. In the regular excel (without pivots) its working on the same data.

I am not sure if my observation is correct.

Hello, did you find any solution for this? I am facing the same issue and yes my excel file also has Pivot table