excel creation with powershell

0

I try to create a excel file in a powershell script using this code :

$xl = New-Object -ComObject "Excel.Application"
$xl.Visible = $false
$xl.DisplayAlerts = $false
$wb = $xl.Workbooks.Open($scriptPath + "\..\..\NeededTools\ExploitationApplication.xlsm")
$global:ws = $wb.sheets.Item(3)

And I face this exception :

New-Object : 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)).

Do someone have informations about this exception or a sample used to generate a excel file correctly ? Is it possible to have this error because I dont have excel on this server ?

excel
powershell
asked on Stack Overflow Jul 28, 2015 by Xavier W.

2 Answers

0

You do not have Excel installed. Or you have, and need to run repair.

answered on Stack Overflow Jul 28, 2015 by (unknown user) • edited Apr 24, 2020 by Community
-1

You do not have Excel installed. Or you have, and have to repair it.

answered on Stack Overflow Apr 24, 2020 by springfeld

User contributions licensed under CC BY-SA 3.0