System Workbook activity - Read Range: Syntax Error

First time posting on the forum, so many apologies in advance if I mess something up!

We are currently near the end of UAT with a client when we discovered that there would be a Syntax Error thrown for System.Workbook’s Read Range activity when we try to restart the Robot to resume a transaction from a previously interrupted file. Strangely enough, this issue can be resolved by replacing all Read Range activities with Excel Application Scope’s Read Range activity, or opening the interrupted file to save it (without making any changes) before running the Robot again.

Not too sure if this is a bug or an undocumented feature(?), would like some inputs! Thanks!

1 Like

Hi @Elaine_Low - usually when a process interacting with an Excel file is interrupted part way through processing, the instance of Excel is still open in the background so the file cannot be used by the robot again until this is resolved. The way to check this is to look at the Details tab in Task Manager for any open instances of Excel and “End Task”, or use UiPath to use the “Kill Process” activity with the process name of EXCEL. This may not resolve all your issues but should definitely help!

2 Likes

Hi Katharine,

Thanks for your reply! But I have already ensured that Excel is killed before I restarted the Robot, and have placed Kill Process activities for Excel before the Robot attempts to Read Range. :pensive:

Hmm that is strange! Are you able to share the details of the Syntax Error message that is being thrown?

Could you add an additional Kill Process before the end of processing as well? Is there a reason that you cannot permanently use the Excel Application Scope’s Read Range activity instead?

Sorry I do not have quick fix!

1 Like

No worries! This is not a particularly urgent problem for me as well, just wanted to understand why this is happening!

Here is the error message retrieved from the Robot Logs, from what I remember it is just the generic Syntax Error that we will get from Read Range activities:

13:48:18.4032 Fatal {“message”:“Transaction M3-2008-5701 failed: System.Exception: Syntax error.\r\n at UiPath.Excel.Activities.WorkbookActivity`1.EndExecute(AsyncCodeActivityContext context, IAsyncResult result)\r\n at System.Activities.AsyncCodeActivity.System.Activities.IAsyncCodeActivity.FinishExecution(AsyncCodeActivityContext context, IAsyncResult result)\r\n at System.Activities.AsyncCodeActivity.CompleteAsyncCodeActivityData.CompleteAsyncCodeActivityWorkItem.Execute(ActivityExecutor executor, BookmarkManager bookmarkManager)\r\n— End of stack trace from previous location where exception was thrown —\r\n at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n at UiPath.Executor.BaseRunner.EndExecute(IAsyncResult result)\r\n at UiPath.Executor.InProcessRunner.EndExecute(IAsyncResult result)\r\n at UiPath.Core.Activities.ExecutorInvokeActivity.EndExecute(AsyncCodeActivityContext context, IAsyncResult result)\r\n at System.Activities.AsyncCodeActivity.System.Activities.IAsyncCodeActivity.FinishExecution(AsyncCodeActivityContext context, IAsyncResult result)\r\n at System.Activities.AsyncCodeActivity.CompleteAsyncCodeActivityData.CompleteAsyncCodeActivityWorkItem.Execute(ActivityExecutor executor, BookmarkManager bookmarkManager)”,“level”:“Fatal”,“logType”:“User”,“timeStamp”:“2020-08-17T13:48:18.4032948+08:00”,“fingerprint”:“d214b629-26e2-4990-9040-24f717fb4969”,“windowsIdentity”:“UTM\uipathrobot”,“machineName”:“UTM-UPROBOT”,“processName”:“Inventory.Update.to.System”,“processVersion”:“5.0.4”,“jobId”:“36739654-0364-4c33-b489-79819095f5dd”,“robotName”:“UTM\UIPATHROBOT”,“machineId”:0,“fileName”:“Main”,“logF_BusinessProcessName”:“Framework”}

Kill Process had been added at the start and end of Process.xaml, but somehow this error still occurred. :thinking:

We can use EAS’ Read Range activity, but it does take a little bit longer to read each file and I am worried that it will affect the processing time, since this client is planning to run quite a bit of transactions each day.

EDIT:
Here are the packages used:
UiPath.Excel.Activities = 2.8.6
UiPath.Mail.Activities = 1.8.6
UiPath.System.Activities = 20.4.0
UiPath.UIAutomation.Activities = 20.4.2

Is this error message what you are seeing the second time you interact with this file? What is causing the file to be interrupted in the first place?

Unfortunately I am not sure why this is happening but it does seem to me to be an issue with Excel instances rather than directly with the UiPath build. I hope someone might be able to explain why! You may need to use some workarounds for now!

I can understand why you may not want to use the EAS Read Range however there are ways to increase speed such as ensuring “Visible” is turned off and you use intermittent Save activities instead of the Auto Save feature, if saving is required.

Hey Katharine, sorry to take up so much of your time!

I have monitored the process a little bit more and I am clearer regarding the error behaviour now.

Our current process flow looks like this:
Read Range > Write Range > Read Range

Originally when we were using System.Workbook Read Range and Write Range activities, the Robot would fail at the second Read Range activity from the Syntax Error. After I have switched the second Read Range activity to an EAS one, we seem to have avoided this error.

However, I realised that when I want to re-input rejected files (files that have been modified by the Robot) for re-processing, the Robot would then fail at the first Read Range activity until I have manually re-saved the rejected files. I am suspecting that the crux of the problem is the Write Range activity, which somehow does not save the file after modifying it…? The file is also an .xlsm file, but that should not be an issue since I have modified .xlsm files before using the same activity without any problems.

Been trawling through the documentation and there is no sign of any reason that could’ve caused this issue. I have since then replaced the first Read Range activity with the EAS Read Range, and the Robot is successfully processing the resubmitted files with no Read Range errors.

I guess the answer is just to use EAS :woman_shrugging:t2:

Please don’t apologise! This is what the forum is for :slight_smile:

The Write Range should be saving changes immediately so again this is strange behaviour. Yes I have also used .xlsm files before and not seen issues.

Seeing as you have found a solution, I would agree you are best to just sticking to this as I also can’t see what the root cause may be! If you had more time and no solution yet, I would suggest debugging step by step, perhaps adding time delays to ensure the file is being saved correctly and reviewing the state of the Excel file at each step, just to investigate further.

I hope this does solve your problem! Good luck with deployment!!

I had issue with UiPath Read Range activity when the file was exported from SAP: there was error with “Metadata”. Excel’s read range did not have such issue. Sometimes going to Excel scope is the only way, I am happy you have resolved the issue.

1 Like

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