question

BobWilson-2805 avatar image
0 Votes"
BobWilson-2805 asked EchoDu-MSFT edited

Transfer Sharepoint List Contents to Excel

Hello,

So I have certain items on a SharePoint List and I would like to transfer the contents of each item to Excel. I’m not talking about the items that I can see once I click on the list but rather the contents of each list item, because each individual item has contents of its own.

Thank you

office-sharepoint-online
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

1 Answer

EchoDu-MSFT avatar image
0 Votes"
EchoDu-MSFT answered EchoDu-MSFT edited

Hello @BobWilson-2805 ,

Welcome to Q&A Forum!

Please following steps:

1.If in the current view not set any filter, in other words you can view all items in the list. You can click on Export >> Export to Excel in the top menu bar

128264-a1.png

128237-a2.png

2.Please run the below powershell script as an admin to export all list items to CSV

 $SiteURL = "https://tenant.sharepoint.com/sites/du"
 $ListName = "listname"
 $CSVPath = "C:\temp\ListData.csv"
 $ListDataCollection= @()
     
 #Connect to PnP Online
 Connect-PnPOnline -Url $SiteURL -Credentials (Get-Credential)
 $Counter = 0
 $ListItems = Get-PnPListItem -List $ListName -PageSize 2000
     
 #Get all items from list
 $ListItems | ForEach-Object {
         $ListItem  = Get-PnPProperty -ClientObject $_ -Property FieldValuesAsText
         $ListRow = New-Object PSObject
         $Counter++
         Get-PnPField -List $ListName | ForEach-Object {
             $ListRow | Add-Member -MemberType NoteProperty -name $_.InternalName -Value $ListItem[$_.InternalName]
             }
         Write-Progress -PercentComplete ($Counter / $($ListItems.Count)  * 100) -Activity "Exporting List Items..." -Status  "Exporting Item $Counter of $($ListItems.Count)"
         $ListDataCollection += $ListRow
 }
 #Export the result Array to CSV file
 $ListDataCollection | Export-CSV $CSVPath -NoTypeInformation

128265-a3.png

128208-a4.png

Thanks,
Echo Du
======================================
If an Answer is helpful, please click "Accept Answer" and upvote it.
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.






a1.png (69.4 KiB)
a2.png (124.5 KiB)
a3.png (94.1 KiB)
a4.png (79.7 KiB)
· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Hi @BobWilson-2805 ,

Have you tried the solution I proposed?
If you have any questions or progress, you can contact me in time.

Looking forward to your reply

Thanks,
Echo Du

0 Votes 0 ·