Skip to main content

How to Add Attachments with Dynamic File Names

You've seen how easy it is to attach files from Google Drive in your email campaigns but there's an alternate, simpler approach as well.

Attach Files by Folder Path​

You can specify the full path of the file in Google Drive and Mail Merge will intelligently find it and attach the file to your outgoing emails.

Here's a screenshot of Google Drive folder containing a file that we need to attaching with our emails.

Drive Folder Path

The file is contained in the Mail Merge > Campaign 1 folder of our Google Drive. We can easily include this file in Mail Merge by specifying the full folder path in the File Attachments column.

\\Mail Merge\\Campaign 1\\brochure.pdf

The correct syntax for adding file attachments by path is:

\\Folder 1\\Folder 2\\....\\filename.ext

Folder Path

Dynamic File Attachments​

Say you are manage a school and would like to send report cards (PDF files) for each student to their parents.

The report card PDF files are stored in your Google Drive and follow a consistent naming pattern. There are hundreds of students so it would take some effort to manually insert the links of every file in your Google Sheet.

This is perfect use cse where dynamic file name attachments combined with sheet formulas can help.

Say the files are stored in Google Drive in the Students folder and each file has the same name as the student's ID with a .pdf extension.

School Folder

Inside the File Attachments column, you can specify the file path as:

\\Students\\Class X-B\\Roll-Number.pdf

If the student's roll number is available in one of the spreadsheet columns, the file name can be specified dynamically using the formula:

=CONCATENATE("\\Students\\Class X-B\\",B6,".pdf")

Dynamic File Names

For more ideas on how to add unique file attachments in mail merge, please watch the video tutorial: