gpt4 book ai didi

excel - 将 PSOBJECT 转储到 Excel 表中

转载 作者:行者123 更新时间:2023-12-03 01:13:48 25 4
gpt4 key购买 nike

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

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等,然后将 CSV 文件转换为 Excel 电子表格。

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

最佳答案

PowerShell: Generate Real Excel XLSX Files without Excel



Export-XLSX PowerShell generate real Excel XLSX files without Excel and COM

对于 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 Gallery

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

另一个链接:

Use ACE Drivers and PowerShell to Talk to Access and Excel

关于excel - 将 PSOBJECT 转储到 Excel 表中,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34181959/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com