Create Google Drive Folders From Your Gmail Lables

Check out my previous post on automating your Google Calendar notifications! It will give you a brief walk-through lesson on enabling Google Apps Script — at least how to find the file type within Google Drive.

Seamless Organization

It would be pretty neat if there was native functionality to allow Gmail Labels to copy over to Google Drive — even save attachments or emails that are in that Label.

For now, we’ll have to do a little scripting. That’s OK with me — I think it’s fun!!

Again, if you’re unsure of how to enable Scripts, check out the link above. Google also has some documentation to help you get started.

A few notes:

  • You will need to authorize Google Scripts to access your Gmail and Google Drive accounts — no big issue here
  • I currently have this set to run once (on my command), but you could set this to run periodically (say once every day to create new Google Drive folders)
  • Unlike the last example, you shouldn’t need to adjust any of the code as the GmailApp and DriveApp services will default to the currently used account
    • If you want to set this script up on another account, you need to be the domain admin (I think that will work) or at a minimum, be the account owner

The Script

Simply copy and paste this into your script editor
function getLabelsCreateFolders () { var email = GmailApp;
    var labels = email.getUserLabels();
    var drive = DriveApp;
    
    for ( x = 0; x < labels.length; x++) {
        drive.createFolder(labels[x].getName());
    }
}

I’m currently working on a way to ‘transfer’ attachments and emails to the folders within GDrive. Stay tuned for that….

Let me know if you have any questions…

Happy Scripting!!

Advertisements

2 thoughts on “Create Google Drive Folders From Your Gmail Lables

  1. This is the wonderful article you have written about Artifical intelligence. I noticed Google is about the AI that has been made as Andrew. There are lots of Andrews but I don’t understand which Andrew this post from edgylabs pointing to. Nonetheless, it looks amazing article and I have heard a great deal.

    Like

  2. This is the great article you have written about Artifical intelligence. I noticed Google is about the AI that is been made as Andrew. There are many Andrews but I do not understand that Andrew this article from edgylabs pointing to. However, it seems awesome article and I have learned a lot.

    Like

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s