Interop.Excel.Application is not defined



I’ve tried importing the Microsoft.Office.Interop.Excel namespace, then within an Invoke code activity putting the following:
Dim xl As Microsoft.Office.Interop.Excel.Application

However, I get the following error message:

Main has thrown an exception

Source: Invoke code

Message: Error compiling code
error BC30002: Type ‘Microsoft.Office.Interop.Excel.Application’ is not defined. At line 1

Exception Type: ArgumentException

System.ArgumentException: Error compiling code
error BC30002: Type ‘Microsoft.Office.Interop.Excel.Application’ is not defined. At line 1

But Intellisense in Invoke Method window gives Microsoft.Office.Interop.Excel.Application namespace.

Did something solve this problem?

Thank you.

Extracting hyperlinks from Excel

I am also curious about this.


Hi Alex,

Were you able to solve the issue? thanks


Do you have the below assembly in your xaml, if not add it manually and restart your project and try again.


How to set the name space and assembly references for Uipath File
Import Microsoft.Office.Interop.Excel does not work
InvokeCode Example
Invoke Code activity with RestShart API calling Issue
Invoke Code doesn't work when trying to manipulate Excel because of missing Assemblies

Thank you very much, after adding this line UiPath could find the reference.


Hi Guys, I fixed that, as vvaidya mentioned, but have still the same issue: error BC30002: Type ‘Microsoft.Office.Interop.Excel.Application’ is not defined. At line 1

Before this fix, there was an error: Cannot find the interop type that matches the embedded type ‘’… Any Idea? Thanks.


Check if “Microsoft.Office.Interop.Excel” is not automatically added



yes. adding the above assembly reference, workflow works fine. But when I edit the workflow in studio, this manually added reference getting deleted all the time. Please help.


This works for me. Just wondering why this entry is not automatically entered by UiPath Studio in the xaml file.


Just hit this issue myself using Microsoft.Office.Interop.Outlook.

If I add the import using the UiPath UI (lower pane) then the reference is not added. I need to manually add the reference two places in the xaml file. Then after I make any edits to the invoke code section the xaml is overwritten and references are lost again.


Seems like an unpleasant bug and makes it almost impossible to import these references.

The thread is also unanswered in this thread