1

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.

1 Answer 1

2

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.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.