A group of Microsoft Products and technologies used for sharing and managing content, knowledge, and applications.
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