In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/03 Report--
Reference documentation:
Https://blogs.technet.microsoft.com/heyscriptingguy/2015/11/25/introducing-the-powershell-excel-module-2/
Https://github.com/dfinke/ImportExcel
It always seems to be a problem to export data from Powershell and easily process it, for example, to export to CSV format.
Popularize a knowledge of CVS Comma-Seperated Value files. Oh, I just knew it, too, and I wondered before.
For example, what we used to do is:
Get-Process | Export-Csv c:\ Temp\ ps.csv # generate CSV file
Invoke-Item c:\ temp\ ps.csv # Open it
There is another way, provided that the computer has to install the EXCEL program, using the EXCEL COM component to open it. As follows:
$xl = New-Object-ComObject excel.application # generate an instance of the EXCEL class
$xl.visible = $true # Let this instance be displayed
$xl.workbooks.add () # add a default table
The good news is that now there is an EXCEL module to support, if your computer's Powershell version is 5.0, you can directly install this module with the following command, and then you can directly call it, a very powerful function.
PS C:\ > Install-Module importexcel
Untrusted repository
You are installing the modules from an untrusted repository. If you trust this repository, change its InstallationPolicy
Value by running the Set-PSRepository cmdlet. Are you sure you want to install the modules from 'PSGallery'?
[Y] Yes [A] Yes to All [N] No [L] No to All [S] Suspend [?] Help (default is "N"): y
After the installation was successful, I was pleasantly surprised to find:
Get-Process | Export-Excel c:\ temp\ psnew.xlsx-show
Of course, this is just the beginning, and more powerful features are yet to come. Open an ISE, put the following code in, and run it to see the result:
Rm $file-ErrorAction Ignoreps | where company | select Company,PagedMemorySize,PeakPagedMemorySize | Export-Excel $file-Show-AutoSize `- IncludePivotTable`-IncludePivotChart `- ChartType ColumnClustered`-PivotRows Company `- PivotData @ {PagedMemorySize='sum';PeakPagedMemorySize='sum'}
Of course, there are some more incredible implementation effects:
$ps = ps$ps | Export-Excel.\ testExport1.xlsx-WorkSheetname memory `- IncludePivotTable-PivotRows Company-PivotData PM`-IncludePivotChart-ChartType PieExploded3D$ps | Export-Excel.\ testExport1.xlsx-WorkSheetname handles `- IncludePivotTable-PivotRows Company-PivotData Handles`-IncludePivotChart-ChartType PieExploded3D-Show
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.