Hi,
I have CSV it contains USERNAME, Manufacturer, Model, hundreds of rows of different Names, Manufacturers and Models. We're looking to quickly few the counts of each model types.
So something similar would be
JohnSmith , HP , 840G8
JaneSmith , Apple , 15 inch iPad Pro
DarringSmith, Dell, 7510
How can I view in a DGV, just the Model and the Counts, so example:
Apple 15 inch iPad Pro 40
HP 840 G8 1500
Dell 7470 1500
CSV into DGV
Forum rules
Do not post any licensing information in this forum.
Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
Do not post any licensing information in this forum.
Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
- apowershelluser
- Posts: 194
- Last visit: Mon Apr 15, 2024 3:21 pm
Re: CSV into DGV
I did find group-object
but used group-object Model
am getting this anyway to shorten the code?
but used group-object Model
am getting this anyway to shorten the code?
- import-csv '\\share\assets.csv' | Select-Object Manufacturer, Model, Count | Group-Object Model | ForEach-Object {
- [PSCustomObject]@{
- 'Count' = $_.Count;
- 'Model' = $_.Name;
- 'Manufacturer' = $_.group.manufacturer | Select-Object -Unique;
- }
- } | Sort-Object Count -Descending
Re: CSV into DGV
Start by writing the code correctly.
- import-csv '\\share\assets.csv' |
- Group-Object Model,Manufacturer |
- Sort-Object Count -Descending |
- Select-Object Name, Count
- apowershelluser
- Posts: 194
- Last visit: Mon Apr 15, 2024 3:21 pm
Re: CSV into DGV
Hi, thanks for the tip
but its not formatted correctly still
note the manufactuer is in the same column as name and not like this
but its not formatted correctly still
note the manufactuer is in the same column as name and not like this
- apowershelluser
- Posts: 194
- Last visit: Mon Apr 15, 2024 3:21 pm