Excel closes before appending/writing, Range Does Not Exist

Hi, I am trying to write a data table into an Excel file. When I run my workflow, it creates an Excel file, opens it in Excel, closes it, and then I get an error Range does not exist

UiPath.Excel.ExcelException: The range does not exist. —> System.Runtime.InteropServices.COMException: Exception from HRESULT: 0x800A03EC
at System.Dynamic.ComRuntimeHelpers.CheckThrowException(Int32 hresult, ExcepInfo& excepInfo, UInt32 argErr, String message)
at CallSite.Target(Closure , CallSite , ComObject , Object[,] )
at System.Dynamic.UpdateDelegates.UpdateAndExecute2[T0,T1,TRet](CallSite site, T0 arg0, T1 arg1)
at CallSite.Target(Closure , CallSite , Object , Object[,] )
at System.Dynamic.UpdateDelegates.UpdateAndExecute2[T0,T1,TRet](CallSite site, T0 arg0, T1 arg1)
at UiPath.Excel.WorkbookApplication.WriteDataTable(Range startRange, Int32 startRow, DataTable newTable, Boolean includeHeaders)
at UiPath.Excel.WorkbookApplication.WriteRange(String startCell, DataTable data, Boolean includeHeaders)
— End of inner exception stack trace —
at UiPath.Excel.Activities.ExcelInteropActivity`1.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)

Main.xaml (90.3 KB)

Here is my project… does it have something to do with writing GenericValues into Excel? Because the way the workflow goes, I need to convert it later to collect errors.

The excel file is not protected, and is writable

hi deathfish – what activity in particular is causing this issue?

I am also facing the same issue with Excel Application scope’s with write range activity.
Please provide some solution.

Hi @akashdande

If your exception is this one: 0x800A03EC, then I found two threads where solution was to close the background excel processes:

I hope it helps :slight_smile: