How to Rename Gmail Emails and File Attachments in Google Drive

Published in: Download Gmail to Google Drive

The premium version of Save Emails offers an easy option to rename file attachments and email messages when the are downloaded to your Google Drive for archiving.

For instance, if the attachment name is “resume.pdf”, you can write a rule that will rename that attachment to, say, “Jan-20-2017 Angus McDonald resume.pdf” where Jan-20 is the date of the email message and Angus is the name of the sender.

Open your Google Spreadsheet, go to Addons > Save Emails > Create Rule (or modify an existing rule) and go to the download section as shown below:


Similar to Mail Merge, you use variable name enclosed in double curly braces.

For instance, if you need to include the name of the sender and the message’s subject in the saved email, you set the File name as {{Subject}} {{Sender}}. Email messages are downloaded in PDF format and the .pdf extension will be added to the name automatically.

For attachments, you can use {{AttachmentName}} (no spaces) to have the saved file name exactly as the original file.

Or use the following format to set the name depending on the date of the message.

{{Year}}-{{Month}} {{Sender}}.{{AttachmentType}}

Here’s a complete list of variables that you can use while setting the name of emails and file attachments with save emails.

VariableDescription / Example
{{AttachmentName}}Original file name (e.g. resume.pdf)
{{AttachmentBase}}Base name of the file (e.g., resume)
{{AttachmentType}}File extension or format (e.g., pdf)
{{MessageId}}Email Message Id
{{ThreadId}}Email Thread Id
{{Date}} (format can be customized)Message Date (e.g., 26-Feb-2017)
{{Day}}26 (dd)
{{DayName}}Wed (EEE)
{{DayNameFull}}Wednesday (EEEEE)
{{Week}}Week Number (ww)
{{Month}}Feb (MMM)
{{MonthNumber}}02 (MM)
{{MonthName}}February (MMMMM)
{{Year}}2017 (YYYY)
{{Sender}}Sender’s Name (from the From field)
{{Recipient}}Recipients Name (from the To field)
{{Subject}}Email Subject
📮  Subscribe to our Email Newsletter for Google tips and tutorials!
Published in: Download Gmail to Google Drive

Looking for something? Find here!

Meet the Author

Web Geek, Google Developer Expert
Amit Agarwal

Amit Agarwal is a Google Developer Expert in Google Workspace and Google Apps Script. He holds an engineering degree in Computer Science (I.I.T.) and is the first professional blogger in India. He is the developer of Mail Merge for Gmail and Document Studio. Read more on Lifehacker and YourStory

Get in touch

Google Add-ons

Do more with your Gmail and GSuite account

We build bespoke solutions that use the capabilities and the features of Google Workspace for automating business processes and driving work productivity.

  1. Mail Merge with Attachments
    Send personalized email to your Google Contact with a Google Sheet and Gmail
  2. Save Emails and Attachments
    Download email messages and file attachments from Gmail to your Google Drive
  3. Google Forms Email Notifications
    Send email notifications to multiple people when a new Google Form is submitted
  4. Document Studio
    Create beautiful pixel perfect documents merging data from Google Sheets and Google Forms
  5. Creator Studio for Google Slides
    Turn your Google Slides presentations into animated GIFs and videos for uploading to YouTube