Exporting data to a CSV file

Scenario description

In many cases, PowerShell commands you run can contain a large amount of results which is hard to digest on screen. In these cases, it is best to export the results into a .CSV file so you use Microsoft Excel to review and manage the results.

This is a simple and common method for extracting and exporting Office 365, Skype for Business Online or SharePoint Online data into a .CSV file.

Exporting data to a CSV file

With most PowerShell commands, by adding on export-csv attribute, you can export the results directly into a .csv file. In this example, replace the Command with the command you want to run and ExportFileName.csv with an appropriate file name.
<Command> | export-csv <ExportFileName.csv>
Resources
Use PowerShell to Create CSV File to Open in Excel

Exporting a directory list to a CSV file and opening the file in Microsoft Excel with Windows PowerShell

Comments

No Comments