Some personal and shared stuff Monday, 14 October 2024 - 10:47

Auto-Save your Gmail Image Attachments to Google Drive

I have written a little Google Script that will auto-save the image attachments in your Gmail inbox to a special folder in your Google Drive. Once the image files have been moved to Drive, you can switch to the Thumbnail view and visually scan your mailbox.

The other big advantage of saving your Gmail images attachments in Google Drive is that you search for text inside images since Drive supports optical character recognition or OCR.

OCR for Gmail Image Attachments

Save your Gmail Attachments in Google Drive

The script runs in the background and will automatically extract images from new incoming mail as well as messages that already exist in your Gmail account. Here’s how you can deploy the script in three easy steps:

  1. Open the script in Drive and  choose File->Make a copy to create a personal copy of that script in your Google Drive.
  2. Choose Run->Authorize to grant the necessary permissions. The script basically needs permissions to read your Gmail inbox and for writing files into your Google Drive Folder.
  3. Once authorized, choose Run -> StartProgram and the script will start working in the background.

You can now exit the Google Script.

Internally, the Google Script will create a new folder called “Gmail Images” in your Google Drive and all images attachments are saved in this folder. Once a message thread has been scanned for attachments in Gmail, a label “Processed” will be added to that thread so that the script can skip it in the next iteration.

You can easy change these default values as explained in the script’s source code.

 

Also, the above script will save every single image attachment from your Gmail to Google Drive. If you would like to selectively save image attachments to Drive, please use the Send to Google Drive program.

Leave a Reply

 

This site uses Akismet to reduce spam. Learn how your comment data is processed.