Now that Google Drive has built file storage into your Google account, it's only natural that you'd like it to play nicely with your other Google apps. With a few tricks, it can—at least with your Gmail account. Tech blogger Amit Agarwal details how to set up a system in which applying a GoogleDrive label to any email in your Gmail inbox will automatically save its attachment to Google Drive—syncing those files directly to your desktop.

Agarwal accomplishes the task using Google's somewhat underused Apps Script language to make this all work—none of which you actually need to know to set it up. The set up is actually extremely easy:

Assuming that you are logged in to your Google account, create a copy of this sheet in your Google Docs (now Google Drive).

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.

Now whenever you label an email with GoogleDrive, your script (which runs every two minutes) will automatically add any attached files to your Google Drive. Awesome, right?

Now, let's say you wanted to automatically save every attachment you receive to Google Drive for easy offline access. Just set up a filter for messages that match the has:attachment search and label all matching incoming messages with GoogleDrive. Click this link for a head start on that filter; it should look something like:

Advertisement

If you wanted to download every single attachment in your Gmail account, just tick the checkbox next to "Also apply filter to X matching conversations" before you click the Create filter button.