Read Range Workbook is not working

Hi,

I am trying to read an excel file using the Read Range Workbook activity. However, I am getting a “Read Range Workbook: Object reference not set to an instance of an object.” error. The worksheet I am reading has contents with format and formulas.

When I use Use Excel File activity, I’m getting a “Read Range: Exception has been thrown by the target of an invocation” error.

I’d really appreciate your help with this. Thanks!

@_pjflo

Try giving the start cell atleats a srange and check

"A1"

Alternately try readding the activity or change the excel package version from manage packages

Cheers

I did both and still getting the same error. I’m not really sure what’s causing the problem.

@_pjflo

Is it the same with excel read range as well?

This does not look usual…can you open the locals panel and check the error details…might get more info

Cheers

I tried using the Use Excel File activity, but whenever I run it, it gets stuck after opening the file then I’m getting a “Read Range: Exception has been thrown by the target of an invocation” error after.

This is what the locals panel looks like:
image

@_pjflo

Open the exception details and check from locals panel.

Is it possible to share the excel here?

Cheers

I’m afraid I can’t share the excel because it contains company details.

Here’s the exception details,

RemoteException wrapping System.NullReferenceException: Object reference not set to an instance of an object.
at ClosedXML.Excel.XLBorder.SetLeftBorder(XLBorderStyleValues value) in C:\projects\closedxml\ClosedXML\Excel\Style\XLBorder.cs:line 378
at ClosedXML.Excel.XLWorkbook.LoadBorderValues(BorderPropertiesType source,
Func2 setBorder, Func2 setColor) in C:\projects\closedxml\ClosedXML\Excel\XLWorkbook_Load.cs:line 1982
at ClosedXML.Excel.XLWorkbook.LoadBorder(Border borderSource,
IXLBorder border) in C:\projects\closedxml\ClosedXML\Excel\XLWorkbook_Load.cs:line 1971
at ClosedXML.Excel.XLWorkbook.LoadPivotStyleFormats(XLPivotTable pt,
PivotTableDefinition ptd,
PivotCacheDefinition pcd,
Dictionary2 differentialFormats) in C:\projects\closedxml\ClosedXML\Excel\XLWorkbook_Load.cs:line 1049 at ClosedXML.Excel.XLWorkbook.LoadSpreadsheetDocument(SpreadsheetDocument dSpreadsheet) in C:\projects\closedxml\ClosedXML\Excel\XLWorkbook_Load.cs:line 785 at ClosedXML.Excel.XLWorkbook.LoadSheets(String fileName) in C:\projects\closedxml\ClosedXML\Excel\XLWorkbook_Load.cs:line 43 at ClosedXML.Excel.XLWorkbook.Load(String file) in C:\projects\closedxml\ClosedXML\Excel\XLWorkbook_Load.cs:line 32 at ClosedXML.Excel.XLWorkbook..ctor(String file, XLEventTracking eventTracking) in C:\projects\closedxml\ClosedXML\Excel\XLWorkbook.cs:line 717 at ClosedXML.Excel.XLWorkbook..ctor(String file) in C:\projects\closedxml\ClosedXML\Excel\XLWorkbook.cs:line 707 at UiPath.Excel.WorkbookFile.InitializeExistingWorbookFile() at UiPath.Excel.WorkbookFile..ctor(String workbookPath, String password, Boolean createNew) at UiPath.Excel.Activities.WorkbookActivity1.ConstructWorkbook(String path,
String password,
Boolean createNew)
at UiPath.Excel.Activities.WorkbookActivity`1.BeginExecute(AsyncCodeActivityContext context,
AsyncCallback callback,
Object state)
at System.Activities.AsyncCodeActivity.InternalExecute(ActivityInstance instance,
ActivityExecutor executor,
BookmarkManager bookmarkManager)
at System.Activities.ActivityInstance.Execute(ActivityExecutor executor,
BookmarkManager bookmarkManager)
at System.Activities.Runtime.ActivityExecutor.ExecuteActivityWorkItem.ExecuteBody(ActivityExecutor executor,
BookmarkManager bookmarkManager,
Location resultLocation)

@_pjflo

Looks like the excel is malformed…can you try saving the excel using save as with a different name and then try reading it

Cheers

Hi @_pjflo Can you try giving some range like “A1:A30” or so in the range field for testing purpose and see still it is giving the same issue

I’m still getting the same error

Hi, I’m still getting the same issue.

@_pjflo

Is it possible to change the data and make it dummy and send the file?

cheers

Trying to understand is it something wrong with the data or the activity. To confirm this can you please do below test

  • Read another sheet from the same file which has few rows/row of normal data (without any formulas etc) with the same activity.Please share the results here

I’m afraid I can do that. The excel file itself has security implementation and contains high sensitive data. I’m so sorry.

I’m getting the same issue even if I’m trying to read this worksheet:

image

Exception details are the same. I tried writing on the worksheet too, but I’m getting the same problem.

@_pjflo

CN you try with another file…may be create a new file and try…then we cna know if its the file issue or no…

Cheers

For other files, it’s working fine.

What kind? If the file has a sensitivity label se tup for example, an error while using read excel will be thrown.

This might be the reason. I’ll try other approach. Thank you all for your help! Appreciate it!