I encountered this same issue when trying to “ReadRange” (not excel).
Based on the error I got…
RemoteException wrapping System.Exception: Syntax error.
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)
If you break down the error… “UiPath.Excel.Activities.WorkbookActivity`1.EndExecute” method has an unhandled syntax error that occurred. If you ignore fixing this, then you seriously undermine the stability of the “ReadRange” activity. You should own the UiPath namespace.
To recreate this issue, you must cause the execution to fail while reading a workbook and then debug with the code behind of the “EndExecute” method available.
Appreciate your assistance. Suffice it to say, the table range, file path, and sheet are valid (as you can see it successfully got the “tableRange” variable populated from the activity “Get Table Range” that was executed right before this).
It isn’t blank. The value of the variable is “A21:E28”. I changed the value to empty string and the same error happens. I changed the sheet name to one that doesn’t exist and the error changes to “The sheet does not exist”. And changed the document path to “” and of course it got another error “Workbook Path needs to be set”. I bring these up since it seems most of the underlying code is working. That doesn’t take away from needing additional troubleshooting.
I changed the sheet name (still pointing to the same XLSX, and it seemed to not error.
This problem never happened until I ran and got an error with Assistant. And now it happens when running from Studio as well. Also, I copied the XLSX and ran automation on it and same problem happened. I executed this on a XLSX file that hadn’t had a problem during the execution and no problem happened. Of course, the problem still happens on the same file or a copy of the same file.
I think the problem has to do with the XLSX file saving with an invalid sheet property when it fails for another workbook/sheet activity. This should be able to be resolved in a “Finally” block when an error occurs during processing. The “Finally” block should open the sheet and ‘save’ it. Hopefully that doesn’t mean it needs to open Excel and save, since that would cause an undue reliance on the “Excel” Application for the Workbook Read Range activity.
Sorry for any confusion, but I am already using Workbook (which just happens to come from the UiPath.Excel.Activities namespace.) The full official namespace for Workbook Range Read is “UiPath.Excel.Activities.RangeRead”.
Turns out Write Range (workbook version) changes all functional values to text instead of preserving the formulas, so it isn’t particularly useful when that is needed.
I will be resorting to probably using Excel Application Scope instead since formula preservation is important to me.
That the activities are in the Excel package doesn’t mean anything. The way Workbook activities interact with Excel is different than Excel Application Scope. But yes, there are cases where EAS is unavoidable.
Turns out WriteRange & ReadRange must not be used repeatedly too fast. They seem to work as long as they aren’t called back to back. Still think there’s a problem and no official solution to this problem. Seems no one is motivated to delve deeper into this problem.