user1601716
user1601716

Reputation: 1993

format excel file after export-csv powershell

Brand new to powershell and trying to modify an existing script.

There is a line that exports a csv file.

Get-Devices $accountID | Export-Csv -Path $DevicesCSV -NoTypeInformation -NoClobber

and It does what it is supposed to do and I get a file in the path specified...

What I want to do is make the file look pretty, make it into a table in excel so columns can be sorted. Add formatting, etc.
I do not see any options to do that and need some guidance on how to accomplish this.

Upvotes: 1

Views: 221

Answers (1)

Robert Dyjas
Robert Dyjas

Reputation: 5227

There are some workarounds, but the easiest way would be to use dedicated module for this, such as ImportExcel by dfinke. It allows you to work with Excel files both ways (importing/exporting).

Get-Help is your friend if you want to learn more about what specific cmdlets like Export-Excel could do.

If you want to sort the data, you can do this before exporting, using Sort-Object cmdlet.

Upvotes: 2

Related Questions