ERROR:Append Range: The given key was not present in the dictionary

This an error happened, ERROR:Append Range: The given key was not present in the dictionary.
But when i open this excel, the append activity has been finished.

Hi @fightblue,

If append range activity has completed its Job and the data you wan to paste is available in the xlsx , you can Ignore the Error Message by putting this activity in a Try/ catch block with just a Writeline/ wtiteLog in Catch Section.


Mukesh

that is a solution, any other better mothed? or why it happened?

Below are the some thins you can Verify.

  1. datatable DT1 which we are pasting is Not Null/ Empty - Can tested by taking and If with condition DT1 is nothing.

  2. Just for Test - Instead of appending - Try Writerange and write the Data to a New Excel - To see whether the data you are pasting is not corrupt.

  3. The Sheet you are Appending the data to has data in expected form. IF in step 2 - You are able to write data Properly to a new excel sheet , then the problem lies with the Excel you are appending the Data to.


Mukesh

1 and 2 I have tested , it is all right. and I tested write cell activity, it has same error.
But I creat a new process, just do the append acitivity or write cell acitivity, there is no error.

can you Run the Process in debug Mode and see what is happening .


Mukesh

in debug mode, the ExceptionDetails:
An ExceptionDetail,
likely created by IncludeExceptionDetailInFaults=true,
whose value is:
System.Collections.Generic.KeyNotFoundException: The given key was not present in the dictionary.
at UiPath.Excel.Activities.WorkbookActivity`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)

I have the exact same error now. The project workflow was working before, nothing changed in the input/output files or the workflow itself, and there is no dictionary involved, just datatables.

I have also tried switching to the App Integrations Append Range activity, but that one does not even append any data - it goes through as if everything went well, but no data is actually appended.

EDIT:
Fixed my issue - check if the output excel file has any comments, and delete them.

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