I am trying to read Excel file using PowerShell. My script works on my machine but it generates the following error when I run it on the server where MS Office is not installed. The client will not intall MS Office on the server. How can I solve this problem?
Error:
Retrieving the COM class factory for component with CLSID {00000000-0000-0000-0000-000000000000} failed due to the following error: 80040154 Class not registered (Exception from HRESULT: 0x80040154 (REGDB_E_CLASSNOTREG))
Script:
$objExcel = New-Object -ComObject "Excel.Application"
I have tried to load Microsoft.Office.Interop.Excel.dll
in my script by coping it to the server. But it doesn't help.
I have tried this solution this solution, but it generates microsoft.jet.oledb.4.0 provider is not registered on the local machine
FYI, I solved this problem using OfficeOpenXml.ExcelPackage.