0

I'm exporting data from PnP PowerShell to a csv file:

Export-Csv -NoTypeInformation -Path "C:\Users\wxmuldom\Documents\Data\TELLDocuments.csv"

There doesn't seem to be any way that I can control the order of the columns. Is there a way to control the column order? Is it possible to export to an Excel Template? Thanks!

1
  • Please provide more details of what you are trying achieve and why PowerShell why not just export from the list directly? Commented Jul 17, 2019 at 19:07

1 Answer 1

1

Do a select with the desired columns and order and pipe that to Export-CSV. Exmaple

Get-Process | select WorkingSet64, ProcessName | Export-Csv c:\testfolder\test.csv

i.e.

your-PNPcmdlet | select yourColumns | Export-Csv filename and options

While there is no direct output to Excel, PowerShell can create an Excel object and write to it using the Excel API. Do a web search for "PowerShell create Excel file" for examples.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.