Download Gmail Attachments and upload them sorted in a Google Drive folder
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.

Gmail Attachments to Google Drive Downloader for Google Apps Script

This script scans your (default config: up to one year old) Mails, creates a subfolder for every message in Google Drive, and downloads the attachments into it.

Setup and First Run

Set the path of your (already existing) target folder (where the subfolders should be created and the attachments downloaded). Run the function "parseAttachments". If the script finishes too fast (it should run a few minutes at least) check the Error Logs (ctrl/cmd + enter). If you get an error message, like "Exceeded maximum execution time", just run the script again, the initial download takes too long, cause it's downloading attachments of your mails up to one year old.


You can create a trigger for the "parseAttachments" function. You could run this function like daily or more often to download the newest attachments into your Google Drive.


I have Documents by Readdle on my Smartphone and Tablet. They're syncing with my "Mail Attachments" folder automatically (and also I've activated "indexing" in the Documents settings). This way I have my attachments locally and can access them offline or with bad internet connection.