I'm trying to use Spire.XLS in PowerShell v.5.0
What I need to do is load an .xlsx file and then save it as a .html
I have exported a powershell object into Excel via the ImportExcel module from Doug Finke which uses the EPPlus.dll library (Link: https://github.com/dfinke/ImportExcel).
Example command:
- Code: Select all
$s = (Get-Content C:\temp\Servers.txt).toupper()
$list = Get-CimInstance -ComputerName $s -ClassName win32_logicaldisk -Filter "deviceid='d:'"
$list | Export-Excel -Path "c:\temp\Servers.xlsx" -Worksheetname "HDD Size"
Then I have manipulated the excel file to my liking (formatting in general like font and cell colors, borders, font sizes, merge cells, even added a chart, etc..).
So now I want to save/export this as a HTML file in order to upload it into an IIS server, so that anyone could see this report.
i have tried Add-Type -Path c:\...\spire.xls.dll or even [system.reflection.assembly]::LoadFrom("c:\...\spire.xls.dll") which both of them seem to work fine.
But after that, I can't fine any type that I can successfully load.
So for example when I'm doing: $obj = New-Object Spire.XLS
nothing happens. In fact I have tried with all of the type names in the dll, as I have run a foreach loop for all of the typenames starting with spire* but to no avail.
Could you please help me.
All I need is to use the spire.xls .NET component into PowerShell, has anyone done this before, and if so, can it even be done?
Or should I look for another solution in order to convert the excel files into HTML
Note: I need to do so without having excel of course, as this will be done on a Windows Server VM, where I don't have Office installed, so using a solution like "New-Object -ComObject" or something like "Microsoft.Office.Interop.Excel" is not suitable.
Thank you all,
Panos