You have an email message in your Gmail inbox and that message contains one or more file attachments. You can apply a label (say GoogleDrive) to that message and automatically all those attachments are saved to one of the folders on your Google Drive.
And since Google Drive will automatically synchronize with your mobile and desktop, the saved email attachments will instantly become available on all your other devices.
How to Send Gmail Attachments to Google Drive
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.
Here’s how you can set up the Google Script in 2 minutes.
- Click here to create a copy of the Google sheet in your Google Drive.
- Open the sheet and you should see a new Gmail to Google Drive menu. Choose Initialize and grant the necessary permissions. This is an open-source Google Script) that runs in your own Google account and no one else will have access to any of your data.
- 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?
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 includes 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. You may also specify a different Gmail Label or Google Drive folder in the Google Sheet before running the script.
If you are getting errors like “Service invoked too many times,” you can increase the trigger duration. Open the same sheet in Google Docs, go to Tools – > Script Editor and then choose Resources – > Current Script Triggers. Change the value of Minutes timer from “Every 5 minutes” to say “Every 15 minutes”.
If you would like to stop the script from running in the background, open the Google Sheet and choose Uninstall from the Gmail menu.
The above script saves all Gmail attachments. You may also choose to save only image attachments from Gmail.