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.
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.
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)
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