I have an issue with an append range action.
I want to copy one sheet from one excel file (I will refer to this file as “old excel file” in this question) to another excel file (“new excel file”).
In order to do this, I used an:
- Excel process scope activity
- In it I have Use Excel file activity, where the excel file is the new excel file and I have “save changes” and “create if not exists” selected as true. Read formatting is “Same as project”.
- In the Use Excel activity I have “For each Excel Sheet” activity, from which I get “NewSheet” variable.
- In it I have Append Range activity, which is where the issue occurred. Here is some information about the Append Range activity:
-
Excel range to append is the sheet from the old excel file “OldSheet” (WorksheetQuickHandle variable), that is passed as an argument in the workflow.
-
Append after range is NewSheet
-
What to copy is set to All.
-
Exclude headers and Transpose are left as false (not selected).
This worked like a charm while testing it with different sheets with different content.
An issue only occurred once, for one specific sheet. The bot created the new excel file with no issue, but an exception occurred in the “Append Range” action and the excel file was left blank. The exception that happened is:
UiPath.Excel.ExcelException: The Paste operation failed. Check if excel allows the paste action with the type of range provided.
I tested the process with the same exact sheet that failed and the second time no issues occurred, which is what made this issue particularly confusing. All other sheets were copied just fine as well.
Has anyone dealt with a similar issue and what can I do to make sure it never happens again?