Excel append range gives UiPath.Excel.ExcelException: Could not write the data table DataTable starting with cell A1

Hi,

I tried to read one excel using the “Read Range” activity and want to insert the data table returned from that activity to another excel using “Append Range”. But it gives me ExcelException mentioned in the title. Below are the logs for the same, can someone suggest a solution on this?

RemoteException wrapping UiPath.Excel.ExcelException: Could not write the data table DataTable starting with cell A1. —> RemoteException wrapping System.Runtime.InteropServices.COMException: The message filter indicated that the application is busy. (Exception from HRESULT: 0x8001010A (RPC_E_SERVERCALL_RETRYLATER))
at System.Runtime.InteropServices.Marshal.ThrowExceptionForHRInternal(Int32 errorCode, IntPtr errorInfo)
at System.Dynamic.ComRuntimeHelpers.CheckThrowException(Int32 hresult, ExcepInfo& excepInfo, UInt32 argErr, String message)
at CallSite.Target(Closure , CallSite , ComObject , Int32 )
at System.Dynamic.UpdateDelegates.UpdateAndExecute2[T0,T1,TRet](CallSite site, T0 arg0, T1 arg1)
at CallSite.Target(Closure , CallSite , Object , Int32 )
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)

1 Like

Hello,

I see the same issue, from time to time, using version 20.4. I believe I saw it also in 20.3.
It will be nice if there is a quick fix.

In my code, I put a step before write range to Kill process (Excel.exe) but no difference.

Vasile.

1 Like

@ajit_jadhav
Attached screenshot please to better assist you

Hi Sandeep13!

attach same issue.

i try with Range and create new pag.

@Exiamen
your excel is up to date? please update excel package and try once

Yes, use Excel package version 2.8.5

reason could be the excel application is busy.
you can kill excel Application first

Yes, I already tried it and it doesn’t work, also change to version 2.4.6 excel package

RemoteException wrapping UiPath.Excel.ExcelException: The range does not exist. —> RemoteException wrapping 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)

Hi there,

I have faced the same issue however using the try catch activity for write range it will write the data-table in excel work book.

Assumption: Due to faster execution of this activity(Write Range) excel work book is closing automatically without timeout that leads to throw an error.

Note: Use Try Catch inside write range activity, in catch use Uipath.Excel.ExcelException

Let me know if this helps

I faced the same issue in my case data is written in the excel file and still getting the error, i tried try catch to make my code work. Any quick fix will be appreciated.

Thanks
Ruchika

Hi, Any solution to this. i also encounter this. when writing to *.xlb.
Error: write range: could not writ eht data table DataTable starting with cell A1

ExcelAppendRangeOneExcelToOther.zip (30.3 KB)

@ajit_jadhav
Please refer the attached file

Mark as solution it works

Hi,

Source: *.xls (read from A2) (20673 rows)
Destination: *.xlsb (write at A2) (it always stop at 1872 rows and stop writing)

for source, i use workbook
for destination i use application scope.

when run, everytime got this error →
write range: could not write the data table DataTable starting with cell A2

Anyone encounter or have any solution.

if i use workbook for above, it works.
i thought for large data, application should work better than workbook.

1 Like

Add some delay (10 seconds or more or less ) between Read Range and Append Range activity. I got the same error and after adding the delay of 10 seconds, it worked for me. You can change the delay accordingly.

Please check the data in your excel. In my case the error is caused by ‘=’ or ‘==’ symbol in one of the row. I noticed this by running it multiple time and saw the robot always stuck at the same row. In my case i can filter the data as it is not required and proceed with write range/append range activity.

4 Likes

This could be due to an error in the cell you’ve read in the read range activity.

In my case, it was ‘negative date’. The robot stopped at the cell having this error.