clock menu more-arrow no yes

Filed under:

Automatically send Gmail attachments to Google Drive with this custom script

New, 6 comments

A custom spreadsheet and script can automatically copy the attachments of messages with a certain tag in Gmail and send them to Google Drive.

Google Drive Gmail Script
Google Drive Gmail Script

It's not difficult to save some individual Gmail attachments to Google Drive, but a script from Amit Agarwal can make this process even easier by automatically adding attachments to a custom Drive folder. The script spreadsheet, available here, creates a new Gmail label and Drive folder, then periodically checks any messages marked with the label and adds their attachments (if there are any) to Drive.

To get it to work, you'll want to copy the spreadsheet to your own Drive (formerly Docs) account and follow the instructions at the link above — basically, you should check for a new "Gmail" menu option on the document, then authorize and run it. After copying the spreadsheet, we needed to close and reopen it to see the Gmail menu, but otherwise it works very simply. The script automatically creates a tag and folder; after you tag an email, it'll take a couple of minutes for the document to show up in Drive.

As Lifehacker points out, you can easily set this to download all attachments (or attachments from specific people) by setting up a filter that includes the "has:attachment" search string and applies the label accordingly. Agarwal has also posted the source code here in order to allay any security concerns.