UiPath.Excel.Activities Read Range activity index was outside the bounds of the array

When is the issue in UiPath.Excel.Activities Read Range activity that results in an “index was outside the bounds of the array” error going to be fixed ?. The error was introduced in version 2.0.6333.17728 5/17/2017 (version 1.2.6256.15131 works fine).

Can you post the screenshot of your workflow @Gid?

The thing is you are referring to a non-existing range

The thing is it works fine in version 1.2.6256.15131, as soon as you update the UiPath.Excel.Activities package to a newer version the same code fails with the error. I am trying to avoid using the Excel application scope.

Can you try with excel application scope and read range of app integration > excel activities instead of system files @Gid

It works fine within the Excel application scope.I do not want to use the application scope as I get a “screen flash” of Excel, even with visibility set to no.

Please check the range or try giving the range as “”,

Have you tried running the read range activity alone @Gid?

I have the range set as “”, running the read range activity alone is when the error occurs.

Hi @Gid

Could you share the fresh project that reproduces the issue? :slight_smile: A full zip of the project folder is much appreciated.

Please find below, its coded so it works (returns the spreadsheet’s rows count), but update the Uipath.Excel.Activities packages to any newer version than 1.2.6256.15131 and it fails.

ExcelTest.zip (215.2 KB)

Thanks for reporting, your project reproduces the issue really nicely. Let me dig around a bit.
EDIT
I registered the bug in our system :slight_smile:

Many Thanks, the work-a-round for now is to use the Excel Application Scope.

Hi,
Do you have an estimate of when a fix for this will be available?

All the best
G

Hi @Gid

It has been reported and is up to our developers to take action on it. I’m sure it will be fixed, but unfortunately I can’t provide a specific promise on when it would be.

is this issue fixed?

I poked inside the activity and see the source of the error. It’s coming from the referenced ClosedXML library while trying to load the sheet. The UiPath.Excel.Activities library is referencing v0.87.1, which was last updated in April 2017. It’s also referencing DocumentFormat.OpenXML 2.5.0 which was released in 2013. Do your devs never update their dependencies? This is poor show for an officially supported component.

Exception stack trace below:

System.IndexOutOfRangeException: Message=Index was outside the bounds of the array.
This exception was originally thrown at this call stack:
    ClosedXML.Excel.XLWorkbook.IsColReference(string) in XLWorkbook_Load.cs
    ClosedXML.Excel.XLWorkbook.SetColumnsOrRowsToRepeat(string) in XLWorkbook_Load.cs
    ClosedXML.Excel.XLWorkbook.LoadPrintTitles(DocumentFormat.OpenXml.Spreadsheet.DefinedName) in XLWorkbook_Load.cs
    ClosedXML.Excel.XLWorkbook.LoadDefinedNames(DocumentFormat.OpenXml.Spreadsheet.Workbook) in XLWorkbook_Load.cs
    ClosedXML.Excel.XLWorkbook.LoadSpreadsheetDocument(DocumentFormat.OpenXml.Packaging.SpreadsheetDocument) in XLWorkbook_Load.cs
    ClosedXML.Excel.XLWorkbook.LoadSheets(string) in XLWorkbook_Load.cs
    UiPath.Excel.WorkbookFile.WorkbookFile(string, string, bool)

While troubleshooting I’ve tried deleting the entire contents of the workbook and leaving a blank new Sheet1, but that file still raises this error. When I looked around and opened Name Manager I discovered there was a whole lot of old junk in there like broken external links. After removing all of them, the error goes away. There’s obviously just an obscure edge case which isn’t handled well by ClosedXML.

Unfortunately this isn’t a viable solution for me since we’re receiving these Excel files from third parties and can’t go to all of them and ask them to clean their files.

2 Likes

Alas, including the latest version of both those nuget packages in my project doesn’t resolve the issue :neutral_face: so no easy fix unless we also fix ClosedXML

Hi @lroos

Thank you for extra insights, I added these to the ticket with which we are tracking this issue.

Hi guys,

I’ve read this post after having the same problem, and my Excel kind of have the same problem like @lroos
I have a hyperlink formula with an empty strings inside it so basically a broken link.
Once you delete them from the Excel the Read Range activity works just fine.
It’s still a bug to fix honestly.

Regards

Using the Excel app scoped activities for any “unsanitized” Excel file input is the safest workaround. Unfortunately the system workbook activities rely on that third party project ClosedXML. It’s community supported and not that actively maintained and there’s a backlog of issues. Would be great if UiPath got behind it as a contributor.

1 Like