Error: 'Microsoft.Office.Interop.Excel.Worksheet'. This operation failed because the QueryInterface call on the COM component for the interface with IID '{000208D8-0000-0000-C000-000000000046}' failed

activities
p_notaproblem

#1

Facing the following issue, while trying to open an excel file.

Main has thrown an exception

Message: Unable to cast COM object of type ‘System.__ComObject’ to interface type ‘Microsoft.Office.Interop.Excel.Worksheet’. This operation failed because the QueryInterface call on the COM component for the interface with IID ‘{000208D8-0000-0000-C000-000000000046}’ failed due to the following error: No such interface supported (Exception from HRESULT: 0x80004002 (E_NOINTERFACE)).

Source: Read Range

Exception Type: InvalidCastException

System.InvalidCastException: Unable to cast COM object of type ‘System.__ComObject’ to interface type ‘Microsoft.Office.Interop.Excel.Worksheet’. This operation failed because the QueryInterface call on the COM component for the interface with IID ‘{000208D8-0000-0000-C000-000000000046}’ failed due to the following error: No such interface supported (Exception from HRESULT: 0x80004002 (E_NOINTERFACE)).
at UiPath.Excel.WorkbookApplication.SetSheet(String sheetName, Boolean createNew)
at UiPath.Excel.Activities.ExcelInteropActivity`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)

Please let me know what can be done.


#2

Will you please share when you are getting this error?
and the excel you are reading is containing what type of data ?

Regards…!!


#3

The excel comprises of three worksheets , two of which has peroidical data(mostly with simple SUM formulas) , and one worksheet has only a chart.
Due to some constraints, I will not be able to share the excel sheet.

As soon as I am launching excel through Excel Application Scope, I get this error on my screen.


#4

Hey @nesachdeva

If it is simple two dimensional chart, made out of the statistical data with SUM formulas., then this link will you help on this :slight_smile:

Regards…!!
Aksh


How to read sheet name of an excel file
#5

Thanks! That works… :slight_smile: :thumbsup:

Also, can you suggest me one more thing? I am getting an error message while I am trying to read a cell in an excel sheet using the Read Range activity. I have tried changing the name of the excel sheet(tab) under name manager, but still it is unable to read the sheet. The error message is as follows -
Main has thrown an exception

Message: The sheet does not exist

Source: Read range

Exception Type: ArgumentException

System.ArgumentException: The sheet does not exist
at UiPath.Excel.WorkbookFile.SetSheet(String sheetName, 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)


#6

Check the sheet name may be it is containg the space with name or just
rename it and let me know


#7

It is working now.
Apparently,we need to take the name of the sheet that appears on the bottom of the excel sheet and not the one which appears under the Name Manager.


#8

Ohh you did not know that . Now you knows :wink:


#9

Yes :slight_smile: