Invoke Code doesn't work when trying to manipulate Excel because of missing Assemblies

excel
uipath
invoke

#1

Hey All, I have an issue with executing code to modify excel file throuh invoke code activity in UiPath

This is the kind of errors I got :

Main has thrown an exception

Source: Invoke code

Message: Error compiling code
error BC31539: Cannot find the interop type that matches the embedded type ‘Microsoft.Office.Interop.Excel._Application’. Are you missing an assembly reference? At line 1
error BC31539: Cannot find the interop type that matches the embedded type ‘Microsoft.Office.Interop.Excel.Workbooks’. Are you missing an assembly reference? At line 2
error BC31539: Cannot find the interop type that matches the embedded type ‘Microsoft.Office.Interop.Excel.Workbook’. Are you missing an assembly reference? At line 3
error BC30002: Type ‘Microsoft.Office.Interop.Excel.ApplicationClass’ is not defined. At line 5

Exception Type: ArgumentException

System.ArgumentException: Error compiling code
error BC31539: Cannot find the interop type that matches the embedded type ‘Microsoft.Office.Interop.Excel._Application’. Are you missing an assembly reference? At line 1
error BC31539: Cannot find the interop type that matches the embedded type ‘Microsoft.Office.Interop.Excel.Workbooks’. Are you missing an assembly reference? At line 2
error BC31539: Cannot find the interop type that matches the embedded type ‘Microsoft.Office.Interop.Excel.Workbook’. Are you missing an assembly reference? At line 3
error BC30002: Type ‘Microsoft.Office.Interop.Excel.ApplicationClass’ is not defined. At line 5

at UiPath.Core.Activities.Workflow.CompilerRunner.Compile(String code, Int32 errLineOffset, Boolean generateInMemory)
at UiPath.Core.Activities.Workflow.CompilerRunner…ctor(String code, String className, String methodName, Int32 errLineOffset, Boolean generateInMemory)
at UiPath.Core.Activities.InvokeCode.GetCompilerRunner(String userCode, List`1 args, String imps)
at UiPath.Core.Activities.InvokeCode.Execute(CodeActivityContext context)
at System.Activities.CodeActivity.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)

PS : I have imported the namespace : Microsoft.Office.Interop.Excel

I have tried solutions presented here : https://forum.uipath.com/t/import-microsoft-office-interop-excel-does-not-work/25453/9
and this added line ( xmlns:moie=“clr-namespace:Microsoft.Office.Interop.Excel;assembly=Microsoft.Office.Interop.Excel” ) gets deleted after each execution of code

and here : https://forum.uipath.com/t/interop-excel-application-is-not-defined/16716/4

But always get that error,

I am using UiPath Studio 2018.1.3 , please help me :slight_smile:

Regards,


#2

Hi There,

Did you get any solution?