Reading Excel files where Office is not installed using PowerShell

I am trying to read an Excel file using PowerShell. My script is running on my machine, but when run on a server where MS Office is not installed, the following error occurs. The client will not run MS Office on the server. How can I solve this problem?

Mistake:

Retrieving 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 tried to load Microsoft.Office.Interop.Excel.dll

into my script by executing it on the server. But that doesn't help.

I tried this solution this solution but it generatesmicrosoft.jet.oledb.4.0 provider is not registered on the local machine

+3


source to share


2 answers


Try EPPlus libary . It is a .net library that reads and writes Excel 2007/2010 files using the Open Office Xml (xlsx) format.

There are at least three PowerShell modules available here that use this library:



+3


source


FYI, I solved this problem using OfficeOpenXml.ExcelPackage.



0


source







All Articles