Forum Discussion

marcojunior's avatar
marcojunior
Occasional Reader
Jan 22, 2026

How to extract full SharePoint Site Usage Analytics via API (avg time, device, heatmap)?

Hello everyone,

 

I'm trying to automate the extraction of SharePoint Site Usage Analytics reports, but I'm running into a limitation where the data exposed by Microsoft Graph API does not match the analytics available in the SharePoint UI or the exported Excel report.

In the SharePoint site analytics page, I can see metrics such as:

  • Unique viewers
  • Site visits
  • Average time spent per user
  • Usage by device
  • Usage by time (heatmap)
  • Trend charts for the selected period (7 / 30 / 90 days)

There is also a Download button that exports an Excel file containing all these analytics.
However, when I query Microsoft Graph using the SharePoint usage reports endpoints (for example:

getSharePointSiteUsageDetail), the API only returns a subset of the data:

 

{
  "lastActivityDate": "2026-01-20",
  "uniqueViewers": "28",
  "siteVisits": "615",
  "avgTimeSpentPerUser": null,
  "byDevice": null,
  "byTimeHeatmap": null,
  "fileCount": "759",
  "activeFileCount": "45",
  "pageViewCount": "615",
  "visitedPageCount": "28",
  "reportRefreshDate": "2026-01-20",
  "reportPeriodDays": "7"
}

 

As you can see:

 

Fields like avgTimeSpentPerUser, byDevice, and byTimeHeatmap are always returned as null.
The numeric values (unique viewers, visits, etc.) are also different from what the SharePoint UI shows for the same time range.
The Graph data appears to be delayed and aggregated differently compared to the UI.


From what I can tell:

These metrics seem to exist internally (since the UI and Excel export clearly show them).

But they are not exposed through any documented Graph API endpoint.

The Excel download does not appear to have a stable or supported API endpoint that can be called programmatically.


My questions

Is there any supported way to programmatically retrieve the full SharePoint analytics dataset (including avg time, device breakdown and time heatmap)?
Is the Excel export endpoint accessible via any supported API?
Are these fields intentionally not exposed in Microsoft Graph?
If this is not possible today, what is the recommended approach for automating this type of analytics collection?

 

Any clarification or official guidance would be greatly appreciated.

 

Thanks in advance!

 

No RepliesBe the first to reply

Resources