Email Attachment Backup with Google Apps Script

A Tutorial & Setup Guide

This guide describes how to set up a Google Apps Script solution that automatically fetches email attachments, renames them based on the email’s subject, and saves them into organized folders in Google Drive. The solution supports both a one‑time run and a daily fetch with deduplication, and it logs all actions in a common log sheet.

Overview

The solution performs the following tasks:

Prerequisites

Before you begin, make sure you have:

  1. A Google account.
  2. A Google Drive folder named "Google Drive Attachments" (create this folder manually in Google Drive).
  3. A Google Sheet that will serve as the dashboard for:
  4. Basic knowledge of how to open the Apps Script editor from your Google Sheet (via Extensions > Apps Script).

Setup & Installation

Follow these steps to set up the solution in your Google Sheet:

1. Create Your Google Sheet