ShareMaster V2 is in beta, a complete rebuild. See what is new and request access →
  1. Home
  2. Guides
  3. Export a file list to Excel

How to Export a SharePoint File List to Excel

The built-in way is Export to Excel from a library view, and it works once the view is flat. It exports only what the current view shows, so you must first tell the view to ignore folders, and it arrives as a web query file rather than a workbook. Here is the short version:

  1. In the library, edit the view (or create one) and under Folders choose Show all items without folders.
  2. Add the columns you want in the sheet: Name, File Size, Created, Created By, Modified, Modified By.
  3. If the library holds more than 5,000 items, filter the view on an indexed column so it stays under the list view threshold.
  4. Select Export, then Export to Excel, and open the query.iqy file that downloads in desktop Excel.

That covers one library you can see in a browser. The rest of this page is about the cases where it falls short: libraries too big for one view, a site with forty libraries, and needing a plain workbook you can hand to an auditor.

What Export to Excel gives you, and what it leaves out

Microsoft describes the export as list items shown in the current view, written into an Excel table with a one-way data connection. A few consequences follow from that wording.

  • The view decides everything. Columns not on the view are not exported. A view showing folders exports the folder you are standing in, not the library.
  • Folders become rows, not structure. Microsoft notes the folder structure does not appear in the table; instead it adds Item Type and Path columns so you can filter and sort. Filter Item Type to drop the folder rows if you only want files.
  • It is a query, not a file. Saving the download gives you query.iqy. Refresh All in Excel pulls fresh data from SharePoint, and edits you make in Excel never go back to the library. Save a copy as .xlsx before you start sorting, or the next refresh rebuilds the table.
  • No CSV for libraries. Lists can export CSV up to 30,000 rows. Microsoft says the CSV option appeared on document libraries briefly by mistake and was disabled. Microsoft also notes that on macOS, CSV is the only export option.
  • The list view threshold still applies. A flat view over a big library needs a filter on an indexed column, which means several exports and a manual merge for a large library.
Tip: File Size in a library view is the current version only. If the reason you want the list is storage, the version history is usually the bigger number, and a storage report by library separates the two.

Where Storage Metrics fits

Site settings, then Site Collection Administration, then Storage Metrics shows each library and folder with its size, and you can drill down folder by folder. It is a good place to see where space has gone. It is not a file list: there is no export, and it answers how big rather than what is in here. For the size question across a tenant, finding large files in SharePoint Online compares the options.

Export a SharePoint file list with PnP PowerShell

A script skips the view entirely and reads the items in pages. This one writes every file and folder in one library to CSV, with a column that says which is which:

$appId = "<your Entra ID app client id>"
Connect-PnPOnline -Url "https://contoso.sharepoint.com/sites/projects" -Interactive -ClientId $appId

$cols = "FileRef","FileLeafRef","File_x0020_Size","Created","Author","Modified","Editor","FSObjType"
Get-PnPListItem -List "Documents" -PageSize 2000 -Fields $cols | ForEach-Object {
    [pscustomobject]@{
        Type       = if ($_["FSObjType"] -eq 1) { "Folder" } else { "File" }
        Path       = $_["FileRef"]
        Name       = $_["FileLeafRef"]
        SizeBytes  = $_["File_x0020_Size"]
        Created    = $_["Created"]
        CreatedBy  = $_["Author"].LookupValue
        Modified   = $_["Modified"]
        ModifiedBy = $_["Editor"].LookupValue
    }
} | Export-Csv -Path ".\projects-documents.csv" -NoTypeInformation -Encoding UTF8

Two notes. You need an app registration of your own in Entra ID for -ClientId, because the shared PnP sign-in app was retired in September 2024. And to cover a whole site, wrap the Get-PnPListItem call in a loop over Get-PnPList filtered to document libraries, appending to the same CSV. From there the script is yours to maintain.

Export the file list with ShareMaster Reports

ShareMaster's desktop app has two reports under Reports that write a library's file list straight to an .xlsx workbook, with no view to build first. Reports is the Report Master part of the app, which the pricing page lists in the free Community licence.

Export File List

  1. Open Reports and select the Export File List tile.
  2. Connect to the site and pick one document library from the tree.
  3. Select Run Report. The workbook is named filereport- followed by the library title, with one worksheet named after the library.

It reads every subfolder of the library, so files at any depth are listed. Each row is one file:

Column What it holds
Full File NameThe server-relative path, so the folder a file sits in is part of the value
File NameThe file name on its own
File SizeSize of the current version in bytes
Created DateDate and time, written as text such as 04 Oct 2026 09:15
Created ByDisplay name of the author
Last Modified DateSame format as Created Date
Last Modified ByDisplay name of the last editor

Folders are not listed as rows. The report skips folder items and keeps files, so an empty folder will not appear at all; read a file's folder from its Full File Name. If empty folders are the thing you are hunting, removing empty folders in SharePoint covers that job.

Sizes and dates are written as text, so convert the File Size column with VALUE() before you sort it largest first. And because one worksheet stops at Excel's row limit of 1,048,576, the report stops just short of it on a truly enormous library and writes a line at the bottom saying not every item could be listed. It never truncates silently.

Modified Files Report

The tile next to it does the same job with a date filter. Choose one library, select Next, set Only include files modified after, and Run Report. You get the same seven columns for files modified after that date only, in a workbook named modifiedFilesReport- plus the library title and the date. It suits "what changed since the migration" or "what has this team touched since the project closed" far better than sorting a full export.

Both reports cover one library per run. They do not include version counts; for that, exporting version counts to Excel is the right report.

Multi-site, in beta: ShareMaster V2, now in public beta, adds an Inventory report that takes several sites at once, optionally with their subsites, and writes one worksheet per list and library using the columns of its default view, plus a Summary sheet that flags any sheet that had to be cut short. Its Folder inventory report goes the other way: one row per folder, empty ones included, with a file count and a total size for each branch.

Which export method should you use?

  • One library, under 5,000 items, you want it today: a flat view and Export to Excel. Nothing to install.
  • You want the sheet to stay current: also Export to Excel, because the query file refreshes. Keep that copy read-only and work on a saved .xlsx.
  • Many libraries, a schedule, or folders as rows: PnP PowerShell, if someone on the team is happy to own a script and its app registration.
  • A plain workbook per library with paths, sizes and both authors, or only what changed after a date: Export File List or Modified Files Report in ShareMaster.

Frequently Asked Questions

Why does Export to Excel only give me the files in one folder?

Because it exports the items shown in the current view, and a normal library view shows one folder at a time. Switch the view to Show all items without folders before you export and the files in every subfolder come through, each with a Path column.

Can I export a document library to CSV?

Not from the library itself. Microsoft says Export to CSV showed up on document libraries for a short time by mistake and was switched off. Lists can export CSV up to 30,000 rows. For a library, use Export to Excel, a PnP PowerShell script with Export-Csv, or a reporting tool.

Can one export cover every library in a site?

Not natively. Export to Excel works on one view of one library. A PnP script can loop over every library and append to a single CSV. ShareMaster's Export File List produces one workbook per library run.

Does the exported file size include version history?

No. File Size on a library item is the size of the current version. Storage held by older versions is reported separately, by a version storage report or a per-library storage report.

What to do next

If the file list is the first step of a migration or a clean-up, the next thing you need is the site-level picture: lists, libraries, owners and sizes. Building a SharePoint site inventory before migration covers what to capture. To see every report Report Master produces, the Report Master feature list has them in one place.

Try ShareMaster free for 14 days