"Failure to submit to convention precedes success due to innovation"

Free App to move Gmail Attachments to Google Drive

Posted by Jeremy D. Stakich on January 19, 2016

The following app Grabs Attachments in your Gmail and moves them to Google Drive

The following tells you how to create an app to manipulate your gmail. The Source Code can be found on GitHub. The link is below This app will: Read your gmail. Search for a certain subject. Look for an attachment with that subject. Move that attachment to a specified folder on Google Drive. Mark that particular email as read Put a label on that email....for example "Already Processed"

1.Create a new folder on Google Drive

2.Right click inside that folder

3.Click More

4.Click Connect more apps

5. Search for Apps Script

6. Click Ok

7. Right Click inside the folder again

8. Go to Google Apps Script

9. Name your project

10. Go to the following link to get the code. Click on Image below to go to link.

11. The file you are looking for is named Code.gs.

Click here

12. Paste the code inside your gs file on Google Drive.

13. Set up triggers if you wish by going to Resources and Clicking on All your Triggers Note this is only if you want it to run periodically with out you having to manually run it.

14. Authorize the app . Click Continue.

15. Click Allow. This is just allowing this app to run on your google account.

16. To test select the doGet Function from the Selections Dropdown.

17. Click the run button that looks like a sideways triangle.

18. Notice that it creates the label "AlreadyProcessed".

19. Notice that it moves the attachment into a folder it creates on google drive.

There are five variables at the top of the Code.gs file that you can change to fit your situation.

They are:

1. fileTypesToExtract

2. labelName

3. folderToProcess

4. num_of_emails_to_read

5. SUBJECT_to_search_for.

This is the start of Variables to set for Application to run ****************************

#1 **************** Type of files to run.

var fileTypesToExtract = ['jpg', 'tif', 'png', 'gif', 'bmp', 'svg' , 'xls' , 'xlsx' , 'txt' , 'docx' , 'doc' , 'rtf' , 'jpeg'];

#2 **************** This is the label to mark the email with after the attachment has been processed

var labelName = 'AlreadyProcessed';

#3 **************** This is the name of the folder that will be created that the attachment will go in.

var folderToProcess = 'jnewfolder';

#4 **************** This is the number of emails to search through

var num_of_emails_to_read = "99";

#5 **************** Put the subject of the email your searching for in this variable

var SUBJECT_to_search_for = "requisition";

************************************* This is the end of Variables to set for Application to run ****************************