Programmatically get Gmail storage usage

Viewed 257

How can I get the storage usage of Gmail programmatically? This value appears in two places, but I cannot find an API for it.

The main goal is to automatically log Gmail storage usage to a Google Sheet and graph the storage usage trend.

What I've tried:

  1. DriveApp.getStorageUsed() does not include Gmail usage.
  2. Reports API (gmail_used_quota_in_mb) is not available for consumer Gmail accounts (only G Suite)
  3. Scraping www.google.com/settings/u/0/storage is not possible because a log-in is required, even when spoofing cookies (probably detects a new device/IP address).

enter image description here

2 Answers
Related