Exception when reading Excel file

Hi,

I recently completed the Basic Training and am now trying to get started on a simple project. First step is reading an excel file, which fails with an exception:

Main has thrown an exception

Message: Syntax error.

Source: Read range

Exception Type: Exception

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)

The only activity I use is “Workbook - Read Range”. It works with the excel file that came with the training, but fails on mine. As in the training, I am leaving the “Range” input open.

The error message is extremely useless in figuring out what the problem is, but I can vary the error message by trying to read different subsets of my file. So I am guessing it has something to do with the way the file is formatted (e.g. the first two rows are headers, some rows are empty, etc.).

It appears that “Read Range” is very sensitive to the format of the excel file. Is there a list of the requirements the excel file must meet? Is there a way to get the whole excel file into a data table regardless of content and then use logic within UiPath to figure out which rows I want to use and which rows to discard? If “Read Range” doesn’t work, what else should I use?

Very frustrating start of the project…

Thanks,
Dirk

1 Like

Hi,

How about use Excel application scope and inside drop “ReadRange” activity as shown(under excel tab)

1 Like

Thanks, that works!

I didn’t know that “ReadRange” behaves differently in the Excel application scope and the workbook one. Is there any documentation I have missed?