Hi all,
We write to you because we have a type of job in our WS2019 cluster that is not running properly. We wanted to ask you if you have any experience with this type of jobs that may help us.
The job in question is a call to a COM excel component in order to retrieve data from an excel sheet. We have installed MS Office 365 on the compute nodes, and the job in question could be summarised by the following line:
powershell -command "$filepath='\shared\temp\test.xlsx';get-item $filepath;$Excel = New-Object -ComObject Excel.Application;$Workbook=$Excel.Workbooks.Open($filepath);$Workbook.Sheets(1).Cells(1,1).Value2;$Excel.Quit();"
If we login manually on the compute nodes and we run the line, we successfully get the contents of the excel file.
If we try to run the line on a HPC Pack job, it fails. We obtain two kinds of error messages. Please find them below:
ERROR 1:
Directory: \shared\Temp
Mode LastWriteTime Length Name
-a---- 2/17/2021 6:20 PM 10278 test_ag_3.xlsx
Microsoft Excel cannot access the file '\shared\Temp\test.xlsx'. There are several
possible reasons:
The file name or path does not exist.
The file is being used by another program.
The workbook you are trying to save has the same name as a currently open workbook.
At line:1 char:139
- ... Excel.Application;$Workbook=$Excel.Workbooks.Open($filepath);$Workbo ...
- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- CategoryInfo : OperationStopped: (:) [], COMException
- FullyQualifiedErrorId : System.Runtime.InteropServices.COMException
You cannot call a method on a null-valued expression.
At line:1 char:182
- ... rkbooks.Open($filepath);$Workbook.Sheets(1).Cells(1,1).Value2;$Excel. ...
- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- CategoryInfo : InvalidOperation: (:) [], RuntimeException
- FullyQualifiedErrorId : InvokeMethodOnNull
ERROR 2:
Directory: \\shared\temp
Mode LastWriteTime Length Name
-a---- 2/17/2021 8:12 AM 10519 test.xlsx
New-Object : Retrieving the COM class factory for component with CLSID {00024500-0000-0000-C000-000000000046} failed
due to the following error: 80080005 Server execution failed (Exception from HRESULT: 0x80080005
(CO_E_SERVER_EXEC_FAILURE)).
At line:1 char:94
- ... em $filepath;$Excel = New-Object -ComObject Excel.Application;$Workbo ...
- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- CategoryInfo : ResourceUnavailable: (:) [New-Object], COMException
- FullyQualifiedErrorId : NoCOMClassIdentified,Microsoft.PowerShell.Commands.NewObjectCommand
You cannot call a method on a null-valued expression.
At line:1 char:134
- ... Excel.Application;$Workbook=$Excel.Workbooks.Open($filepath);$Workbo ...
- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- CategoryInfo : InvalidOperation: (:) [], RuntimeException
- FullyQualifiedErrorId : InvokeMethodOnNull
You cannot call a method on a null-valued expression.
At line:1 char:177
- ... rkbooks.Open($filepath);$Workbook.Sheets(1).Cells(1,1).Value2;$Excel. ...
- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- CategoryInfo : InvalidOperation: (:) [], RuntimeException
- FullyQualifiedErrorId : InvokeMethodOnNull
You cannot call a method on a null-valued expression.
At line:1 char:215
- ... .Open($filepath);$Workbook.Sheets(1).Cells(1,1).Value2;$Excel.Quit();
- ~~~~~~~~~~~~~
- CategoryInfo : InvalidOperation: (:) [], RuntimeException
- FullyQualifiedErrorId : InvokeMethodOnNull
Could you please help us out here? Do you have any insight on this type of jobs based on Office and COM?
Best Regards,
Alberto