Forum Discussion
Srinivas Pisipati
Mar 23, 2018Copper Contributor
Export SharePoint List to CSV and Upload to Document Library
Hello All,
I am the Owner of O365 SharePoint Site Collection. And we were maintaining a List with Team Members for P1 Availability. Columns are as below:
Emp_ID -- Single l...
Deleted
Mar 23, 2018You can try below Powershell script to export list and run it periodically using task scheduler.
Add-PSSnapin Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue #Get the Web $web = Get-SPWeb -identity "http://sp2013/sites/team" #Get the Target List $list = $web.Lists["CustomList36"] #Array to Hold Result - PSObjects $ListItemCollection = @() #CAML Query $spQuery = New-Object Microsoft.SharePoint.SPQuery $spQuery.ViewAttributes = "Scope='Recursive'"; $spQuery.RowLimit = 2000 $caml="<Where><Eq><FieldRef Name='Department'/><Value Type='Text'>D1</Value></Eq></Where>" $spQuery.Query = $caml #Get All List items $listItems=$list.GetItems($spQuery) foreach($item in $listItems) { $ExportItem = New-Object PSObject $ExportItem | Add-Member -MemberType NoteProperty -name "Title" -value $item["Title"] $ExportItem | Add-Member -MemberType NoteProperty -Name "Department" -value $item["Department"] #Add the object with property to an Array $ListItemCollection += $ExportItem } #Export the result Array to CSV file $ListItemCollection | Export-CSV "c:\Backup\ListData.csv" -NoTypeInformation #Dispose the web Object $web.Dispose()
Export