Share via

How to export a csv or excel file that can check details the storage structure of my company's Sharepoint

Anonymous
2025-02-27T02:28:44+00:00

My IT admin can export a csv file that can check the storage structure of sites within my company Sharepoint (like in the image). However, my demand is to see the storage structure of folders within each site, and folders within folders, so on. My IT admin has no idea to do that. Can I ask for solution?
Thank you guys.

Microsoft 365 and Office | SharePoint | For business | Other

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments

1 answer

Sort by: Most helpful
  1. Anonymous
    2025-02-27T05:46:49+00:00

    Dear Nguyen Hoang An1,

    Thank you for reaching out.

    According to my research and testing, there are two methods that can achieve your requirement.

    The first method is to use the PowerShell command.

    first you need PNP PowerShell module installed for more info --- >>> PnP PowerShell Overview

    # Connect to the SharePoint site
     Connect-PnPOnline -Url "https://your-tenant-name.sharepoint.com/sites/yoursite" -UseWebLogin
     
    # Get all document libraries in the site
     $libraries = Get-PnPList | Where-Object {$_.BaseType -eq "DocumentLibrary"}
     
    # Prepare an array to hold the output
     $output = @()
     
    foreach ($library in $libraries) {
         # Ensure the library contains items before proceeding
         try {
             # Check if the library has any items
             $items = Get-PnPListItem -List $library.Title -Fields FileRef, FileLeafRef, File_x0020_Size
     
            if ($items) {
                 # Process each item in the library
                 foreach ($item in $items) {
                     $outputObj = New-Object PSObject -property @{
                         Library    = $library.Title
                         FilePath   = $item["FileRef"]
                         FileName   = $item["FileLeafRef"]
                         FileSizeKB = [math]::round($item["File_x0020_Size"] / 1KB, 2)
                     }
                     $output += $outputObj
                 }
             } else {
                 Write-Warning "No items found in library: $($library.Title)"
             }
         } catch {
             Write-Warning "Failed to retrieve items from library: $($library.Title). Error: $_"
         }
     }
     
    # Export the results to CSV
     $output | Export-Csv -Path "C:\Path\to\export\SharePointFileStorageUsage.csv" -NoTypeInformation
     
    Write-Host "Export complete!"
    

    • second option is using storage metrics ( Please note that you cannot export the data directly. However, you can print or export it to PDF by using the "Print" option in your browser)

    go to the site settings >> Storage Metrics

    • The third option is to use the content search.

    click here to learn about content search --- >>> Get started with Content search

    Thank you for your time and patience, we hope you have a great day!

    Kind regards,

    Community Moderator | Sophia

    Was this answer helpful?

    1 person found this answer helpful.
    0 comments No comments