How to Rename Gmail Emails and File Attachments in 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
Amit Agarwal

Amit Agarwal

Google Developer Expert, Google Cloud Champion

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.

Amit has developed several popular Google add-ons including Mail Merge for Gmail and Document Studio. Read more on Lifehacker and YourStory


Awards & Titles

Digital Inspiration has won several awards since it's launch in 2004.

Google Developer Expert

Google Developer Expert

Google awarded us the Google Developer Expert award recogizing our work in Google Workspace.

ProductHunt Golden Kitty

ProductHunt Golden Kitty

Our Gmail tool won the Lifehack of the Year award at ProductHunt Golden Kitty Awards in 2017.

Microsoft MVP Alumni

Microsoft MVP Alumni

Microsoft awarded us the Most Valuable Professional (MVP) title for 5 years in a row.

Google Cloud Champion

Google Cloud Champion

Google awarded us the Champion Innovator title recognizing our technical skill and expertise.

Email Newsletter

Sign up for our email newsletter to stay up to date.

We will never send any spam emails. Promise.