By using this script you can archive Gmail messages to Google Drive including message attachments. First of all create a copy of the following spreadsheet document: Archive Gmail messages to Google Drive
The spreadsheet document should contain a new menu item called “Gmail Archiver”. Click on “Gmail Archiver” menu and select “Initialize”. You should see an authorization request like the following:
Press “OK” button to authorize and follow the authorization process. Now click again on “Gmail Archiver” menu and select “Initialize”. You should see now a confirmation box about the successful initialization of the script.
The script created for you a new Gmail label called “Archive to Drive” and a new drive folder called “Email Archive” where Gmail messages will be stored.
Now go to Gmail and add the Gmail label “Archive to Drive” to each message you want to archive:
Now go back to the spreadsheet document and click on “Gmail Archiver” menu and select “Archive Gmail Messages”. After some seconds you should see a message like:
Now go to Google Drive inside folder “Email Archive” and you should see a new folder representing the exported email message:
Now entering the newly created folder you should see the email messages content saves as a PDF file and all message attachments saved as separate files:
Enjoy and happy scripting!