Excel Application Scope error: Value cannot be null. Parameter name: o at Source: UiPath.Excel

I am getting an error out of the Excel Application Scope when opening a handful of files within a process being run. The file name comes from an enumeration of files in the directory. The file exists. Copying the file path from either the Write Line Output or the Exception error message into Excel, Excel has no problem opening the file. This does no appear to be a problem with a bad path or file name.
Activites%20in%20flow
Excel%20Scope
ExcelApplicationScope%20properties

The images show the activities involved and that the Write Line is outputting exactly the string enumeration item that the Excel Application Scope is being asked to open. Also shown are the properties set for the Excel Application Scope.
After the Excel Application Scope faults, execution goes to the catch block and outputs the Exception message and source information.

The Output when running in debug mode shows:

C:\Projects\Data\NamedSource\Output\Operations- Drilling\NamedWell\Geology\Logs\MWD\Daily\20180902_083850\NamedWell_Survey.xlsx
Write Line Executing
Write Line Closed
Assign: Directory FileCount Increment Executing
Assign: Directory FileCount Increment Closed
Try: Open Excel and Process File Executing
ExcelScope: Process File Executing
ExcelScope: Process File Faulted
Seq: Open And Process Excel Workbook Excel Exception Executing
System error at Open And Process Excel Workbook (C:\Projects\Data\NamedSource\Output\Operations- Drilling\NamedWell\Geology\Logs\MWD\Daily\20180902_083850\NamedWell_Survey.xlsx): Value cannot be null.
Parameter name: o at Source: UiPath.Excel

There are a few files that the process attempts to load that have this same behavior. Same error. In each case, the files exist, copy/paste the fully qualified file name into Excel and it opens fine. The rest of the files process without a problem. The following is successfully processed:
C:\Projects\Data\NamedSource\Output\Operations- Drilling\NamedWell\Geology\Logs\MWD\Daily\20180902_095558\NamedWell_Survey.xlsx

Both the files that fail and the ones that succeed are 49kb and have the same parent directory structures, it’s just the date named directory where each file differs. This isn’t a permissions issue to a directory or path. The bot populated these directories by downloading these files in a previous step. They aren’t large files and all are xlsx extensions.

The files are not being modified, therefore are being opened Read Only.

Excel Activities installed version: 2.4.6863.30657
This is being run in UiPath Studio 2018.3.0

Any suggestions on what might be causing the error or how to resolve it?

Thanks!

Use Kill process with process name “excel” before Excel application scope and try.

Do not use kill excel inside the excel scope, never.
@khan can you send me a reproducible workflow?

Unfortunately, the file contents are proprietary and I cannot share those.

I have added a dispose for the workbook application object after the Excel scope, as a just in case. I am going to add the kill at the beginning of the overall process as well.

1 Like

I have the same error. I sure that you must kill excel with “CMD”. So that you can try

I ran in to this error just recently. From what I can tell it looks like it was an issue where the workbook my job was trying to open already had an instance opened with the same file name from a previous failed job.

1 Like

Thank you so much, you helped me before I tore my hair out. :slight_smile: