SharePoint Online - Report (export) all sites, folders, files with folder and file size and type

Silver Contributor


is it possible to make a report or to export all sites, folders, files from a SharePoint Online with all names, sizes and file types in a CSV file?

Could this be done with directly from SharePoint Online, PowerShell or Microsoft Graph + PowerShell?

I appreciate your answer.

Kindest regards


1 Reply
best response confirmed by LeonPavesic (Silver Contributor)
So there's two ways, Graph API or PowerShell that goes through it all for example:

The code is quite old and won't work but you can get a hum of how to approach this to.

As for Graph API you need to get all Sites, then all libraries in that site, here's some to the API:s you can make use of:

I recommend going the Graph way and doing this in runbook or similar