将PSOBJECTs转储到Excel表格中

我有以下集合包含以下对象:

PS C:\blabla> $CSVText.gettype() IsPublic IsSerial Name BaseType -------- -------- ---- -------- True True Object[] System.Array PS C:\blabla> $CSVText[0].gettype() IsPublic IsSerial Name BaseType -------- -------- ---- -------- True False PSCustomObject System.Object 

我想直接将这个PSOBJECT集合转储到一个xlsx文件中,而不是使用$CSVText | Export-CSV $CSVText | Export-CSV等,然后将CSV文件转换为Excel电子表格。

我正在寻找一个直接的方法来做到这一点,从OBJECT到Excel,没有涉及任何转换和临时CSV文件。 那可能吗?

PowerShell:不使用Excel生成真正的Excel XLSX文件

Export-XLSX PowerShell生成没有Excel和COM的真正的Excel XLSX文件

对于Powershell v5:

 Find-Module *excel* Version Name Repository Description ------- ---- ---------- ----------- 0.5.9 ExcelPSLib PSGallery ExcelPSLib is a PowerShell Module that allows cr... 1.90 ImportExcel PSGallery PowerShell module to import/export Excel spreads... 1.0 PSExcel PSGallery Work with Excel without Excel 

或在画廊的网站:

PowerShell图库

请注意,图库中的模块可能使用较低的版本,只是需要PowerShellv5的“Find-Module”cmdlet

多一个链接:

使用ACE驱动程序和PowerShell与Access和Excel对话