I have found the custom lists in a particular site and I want to print the names to Excel. How do I do it?


You can pipe the output from your command to an .csv file:

FileToExecute.ps1 | Out-File C:\output.csv

Make sure you in your script file uses Write-Outputand not Write-Host when printing your output.

  • Thanx Robert it works. – Jon Jun 16 '14 at 11:36

Use the following Command:

$spWeb = Get-SPWeb SiteUrl
$spWeb.Lists | select Title | Export-CSV c:\Lists.csv

You can export any output of the powershell to a CSV. This is a built in function.



You wanna use the Export-Csv parameter. I also found this easy example.

SharePoint list to .csv file


$MyWeb = WebUrl 
$MyList = MyWeb.Lists["ListName"] 
$MyItems = $MyList.Items
$MyItems | Select Fields.. | Export-Csv -path C:\example\excel.csv

Your Answer

