With Google now providing free space on Google Drive, on may want all the Gmail attachments that is gets on his email or that he already have on to Google Drive. This post explains a simple and fairly easy way to do that.
If you would like to have a similar setup for your Gmail and Google Drive, all you need is a minute. Just follow these easy steps:
- Assuming that you are logged in to your Google account, create a copy of this sheet in your Google Docs (now Google Drive).
- Go to Gmail create a Label "GoogleDrive" to filter only emails that has attachments. Also, you will need to create a folder in the GoogleDrive with the name "Gmail". Please make sure that the names are correctly spelled.
- Open the sheet and you should see a new Gmail menu – click Initialize and grant the necessary permissions. This is your sheet (see source code) and you are not sharing your Google credentials or data with anyone else.
- Next go the Gmail menu again and select Run. Close the Google sheet and you are done.
Here’s how the program works. The Google sheet will monitor your Gmail mailbox in the background (every two minutes) and as soon as it finds any message that has a label GoogleDrive, it will automatically save all the attachments in that message to the Gmail folder on your actual Google Drive.
Once the basic setup is ready, apply the label GoogleDrive to any of your email messages in Gmail and the attached files should become available in your Drive (both online and offline) in the next few minutes.
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, go to the same trigger screen and simple delete the “SendToGoogleDrive” time trigger.