Error Related to Write in Excel

The activity ‘Invoke Delete Account workflow’ with ID 46 threw or propagated an exception while being canceled.

RemoteException wrapping System.InvalidOperationException: The activity ‘Invoke Delete Account workflow’ with ID 46 threw or propagated an exception while being canceled. —> RemoteException wrapping System.InvalidOperationException: The activity ‘For Each Excel Row’ with ID 9 threw or propagated an exception while being canceled. —> RemoteException wrapping System.Runtime.InteropServices.InvalidComObjectException: COM object that has been separated from its underlying RCW cannot be used.
at System.StubHelpers.StubHelpers.GetCOMIPFromRCW(Object objSrc, IntPtr pCPCMD, IntPtr& ppTarget, Boolean& pfNeedsRelease)
at Microsoft.Office.Interop.Excel.ApplicationClass.Intersect(Range Arg1, Range Arg2, Object Arg3, Object Arg4, Object Arg5, Object Arg6, Object Arg7, Object Arg8, Object Arg9, Object Arg10, Object Arg11, Object Arg12, Object Arg13, Object Arg14, Object Arg15, Object Arg16, Object Arg17, Object Arg18, Object Arg19, Object Arg20, Object Arg21, Object Arg22, Object Arg23, Object Arg24, Object Arg25, Object Arg26, Object Arg27, Object Arg28, Object Arg29, Object Arg30)
at UiPath.Excel.RangeOperations.<>c__DisplayClass4_1.b__2()
at UiPath.Excel.ExcelContextHelper.Execute[T](Func1 func, ExcelContext context, Object[] contextParams) at UiPath.Excel.WorkbookApplication.XlRange(Func1 func, Range& excelRange, String rangeAddress)
at UiPath.Excel.RangeOperations.IsRangeEmpty(String rangeAddress)
at UiPath.Excel.CurrentRowQuickHandle.IsCurrentRowEmpty()
at UiPath.Excel.CurrentRowQuickHandle.b__28_0()
at System.Lazy1.CreateValue() at System.Lazy1.LazyInitValue()
at System.Lazy1.get_Value() at UiPath.Excel.Activities.QuickHandle.RowsProcessor.IteratorShouldStop(Lazy1 isRowEmpty)
at UiPath.Excel.CurrentRowQuickHandle.System.Collections.IEnumerator.MoveNext()
at UiPath.Shared.Activities.Business.ForEachEnumeratorExtensions.Iterate[T](Variable1 enumeratorVariable, NativeActivityContext context, ActivityInstance completedInstance, Boolean exitLoop, Action1 doAction, Action1 completedAction, Action1 exitAction)
at UiPath.Excel.Activities.Business.ExcelForEachRowX.InternalExecute(NativeActivityContext context, ActivityInstance completedInstance)
at System.Activities.Runtime.ActivityCompletionCallbackWrapper.Invoke(NativeActivityContext context, ActivityInstance completedInstance)
at System.Activities.Runtime.CompletionCallbackWrapper.CompletionWorkItem.Execute(ActivityExecutor executor, BookmarkManager bookmarkManager)
— End of inner exception stack trace —
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at UiPath.Executor.BaseRunner.EndExecute(IAsyncResult result)
at UiPath.Executor.InProcessRunner.EndExecute(IAsyncResult result)
at UiPath.Core.Activities.ExecutorInvokeActivity.EndExecute(AsyncCodeActivityContext context, IAsyncResult result)
at System.Activities.AsyncCodeActivity.System.Activities.IAsyncCodeActivity.FinishExecution(AsyncCodeActivityContext context, IAsyncResult result)
at System.Activities.AsyncCodeActivity.CompleteAsyncCodeActivityData.CompleteAsyncCodeActivityWorkItem.Execute(ActivityExecutor executor, BookmarkManager bookmarkManager)
— End of inner exception stack trace —
at System.StubHelpers.StubHelpers.GetCOMIPFromRCW(Object objSrc, IntPtr pCPCMD, IntPtr& ppTarget, Boolean& pfNeedsRelease)
at Microsoft.Office.Interop.Excel.ApplicationClass.Intersect(Range Arg1, Range Arg2, Object Arg3, Object Arg4, Object Arg5, Object Arg6, Object Arg7, Object Arg8, Object Arg9, Object Arg10, Object Arg11, Object Arg12, Object Arg13, Object Arg14, Object Arg15, Object Arg16, Object Arg17, Object Arg18, Object Arg19, Object Arg20, Object Arg21, Object Arg22, Object Arg23, Object Arg24, Object Arg25, Object Arg26, Object Arg27, Object Arg28, Object Arg29, Object Arg30)
at UiPath.Excel.RangeOperations.<>c__DisplayClass4_1.b__2()
at UiPath.Excel.ExcelContextHelper.Execute[T](Func1 func, ExcelContext context, Object[] contextParams) at UiPath.Excel.WorkbookApplication.XlRange(Func1 func, Range& excelRange, String rangeAddress)
at UiPath.Excel.RangeOperations.IsRangeEmpty(String rangeAddress)
at UiPath.Excel.CurrentRowQuickHandle.IsCurrentRowEmpty()
at UiPath.Excel.CurrentRowQuickHandle.b__28_0()
at System.Lazy1.CreateValue() at System.Lazy1.LazyInitValue()
at System.Lazy1.get_Value() at UiPath.Excel.Activities.QuickHandle.RowsProcessor.IteratorShouldStop(Lazy1 isRowEmpty)
at UiPath.Excel.CurrentRowQuickHandle.System.Collections.IEnumerator.MoveNext()
at UiPath.Shared.Activities.Business.ForEachEnumeratorExtensions.Iterate[T](Variable1 enumeratorVariable, NativeActivityContext context, ActivityInstance completedInstance, Boolean exitLoop, Action1 doAction, Action1 completedAction, Action1 exitAction)
at UiPath.Excel.Activities.Business.ExcelForEachRowX.InternalExecute(NativeActivityContext context, ActivityInstance completedInstance)
at System.Activities.Runtime.ActivityCompletionCallbackWrapper.Invoke(NativeActivityContext context, ActivityInstance completedInstance)
at System.Activities.Runtime.CompletionCallbackWrapper.CompletionWorkItem.Execute(ActivityExecutor executor, BookmarkManager bookmarkManager)

Can anyone help me to understand what happen to my automation from this error details? This happen suddenly and never happen before when I test my automation. Please kindly help me and thank you!

Hi @YUDISTIRO_Evan

Can you show what are trying to do and did you check in debug if the datatable is initialized or not?

And did you recently upgrade your packages?

If so what are the current package versions and what is your studio version

Cheers

Hi @YUDISTIRO_Evan

Welcome to UiPath community

Can you tell us what is version of studio and version of UiPath system.activities version?

Check out this thread

Regards
gokul

I am trying to write a status in status column in excel with Write Cell activity, usually it works perfectly, but today when the robot run the automation based on the trigger set this Error happened, The robot was still running the process and passed the “Write Cell Success” log message which I put after Write Cell Activity and so on, but when the robot stopped I checked the Excel file and the Status Column is still blank from the first row even though the process already done until the last row in the process but just the Write Cell which not updated in the Excel and when I checked the Error Details that message came up

my Uipath system.activities version is 22.4.4 and my studio version is 2021.10.5, is it related to version difference? Because when I run the robot yesterday, it worked perfectly with this version but today this happened

Hi @YUDISTIRO_Evan

Please check this thread

Because write cell is being used multiple times in loop it might have failed.

Cheers

HI,

There might be zombie excel process. Can you try to put KillProcess to kill “excel” at the beginning of the project?

Regards,

okay, I will try to put KillProcess and see if it could stabilize this process without this kind of error happening again, and thank you so much for the solution!

so the solution is the version of 21.4? but my studio already got the version of 2021.10.5, I kinda confuse right now

Hi @YUDISTIRO_Evan

It is a one of scenario that you saw… you can use a kill process or have some delay before write cell to avoid such scenarios in future .

From 21.4 this issue was addressed in few activities so even in latest ot should have been addressed

Cheers

ok, thank you so much for helping me, I really appreciate it! I will put kill process at the initialization state and delay before all write cell activity in my automation.

Best Regards

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.