1

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

4

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
3

Use the following Command:

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

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

Export-CSV

0

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

SharePoint list to .csv file

Export-Csv

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.