Send Gmail attachments to Google Drive

Send Gmail attachments automatically to Google Drive

Save your Gmail attachments to Google Drive automatically

This little Google Script will help you automatically send your Gmail attachments to Google Drive. You don’t have to install any extensions and the technique can even be used in any of the mobile apps of Gmail. Saving your files to Google Drive lets you get to them from any computer, phone or tablet.

You need a Google Drive account and a GMAIL account so make sure you have this and are signed in to your Google account. This only works within Gmail, so if you're using desktop e-mail apps or other clients to get to your Gmail, this won't work.

Here’s how you can set up the Google Script.

Download the Google docs script

Download the Google docs script

Here is a link to the Google docs script. Download it and then open it.

Some preparation - GMAIL

Some preparation - GMAIL

Create a new label in Gmail called SendToGoogleDrive.

Look in Settings, Labels in your Gmail account.

Initialise the script

Initialise the script

Open the sheet and you should see a new Gmail to Google Drive menu. Choose Initialize.

This script runs in your own Google account and no one else will have access to any of your data.

Authorise the script

Authorise the script

Grant the necessary permissions.

media_1387138017160.png

Click Accept.

Run the script

Run the script

Click the Gmail to Google Drive menu again and select Run.

Close the Google sheet and your Gmail attachments will start transferring to your Google Drive in the background.

How the Google script works

How the Google script works

The Google sheet will monitor your Gmail inbox in the background (every five minutes) and as soon as it finds messages with the label GoogleDrive, it will automatically save all the attachments included in those message to the GmailAttachments folder on your Google Drive.

Once the attachments have been saved, the GoogleDrive label is removed from the message.

The image above is the Google Drive folder on the computer (a MAC). A Windows computer will also have a Google Drive folder in the File Manager or a shortcut on the Desktop.

1. Inside the Google Drive folder is the Google script: Copy of Send to Google Drive v3.0 gsheet.

2. When the script was run, a Gmailattachments folder was also saved inside the Google Drive folder.

What you need to do when you receive email

What you need to do when you receive email

When you receive any mail with an attachment:

  1. Open the message and add the label SendToGoogleDrive to the mail message. The Google script is automatically scanning your GMAIL account for this label.
  2. When it sees a message with this label, the attachment will be stored in the GmailAttachments folder, and the label removed.
  3. The original attachment also remains with the message.

If you delete the message, the attachment is also deleted. However, a copy of that attachment will be stored in your Google Drive folder - in the GmailAttachments folder.

media_1387140479239.png

A mail message with the label attached.

Removing the script

Removing the script

If you would like to stop the script from running in the background, open the Google Sheet in the Google drive folder and choose Uninstall from the Gmail to Google Drive menu.

One click download of attachments

One click download of attachments

In the latest update to Gmail, you can also download attachments directly from the message.

Hold your mouse over the attachment and click the Google Drive icon. Select the folder or add a new folder and click Done.