Attach Files from Google Drive in Email Messages
With Document Studio, you can attach any file from Google Drive in your email messages. You may also attach files that have been uploaded through the File Upload Field in your Google Form responses.
Attach Files Syntax
The default syntax for attaching files in email messages is:
{{ Embed FILE, File Id OR File Url OR File Name OR File Path OR File Upload Question }}
Attach File By Id
Provide the file id of the file in Google Drive you want to attach.
{{ Embed FILE, Drive File Id }}
Attach File By URL
Provide the URL of the file in Google Drive you want to attach.
{{ Embed FILE, Drive File URL }}
Attach File By File Name
Provide the full name of the file in Google Drive you want to attach. Document Studio will search for the file in your Drive and, if a matching file is found, will attach it to the email message.
{{ Embed FILE, File Name with Extension }}
Attach File By Folder Path
If you have multiple files in Google Drive with the same name, you can specify the folder path with the file name to attach a specific file inside a specific folder.
{{ Embed FILE, /Folder A/Folder B/File Name.extension }}
Attach File By Form Question
If you have file upload field in a Google Form, you can attach the file by specifying the question name in the embed formula.
{{ Embed FILE, File Upload Question }}
Working Examples
Attach File from Google Drive
Open your Google Drive and right-click the file that you need to attach with your email messages. Click the Get link
item from the context menu and copy the link of the file.
Inside the email message template, paste the link of the file in the Embed FILE
formula as shown here:
{{ Embed FILE, https://drive.google.com/file/d/1KHy848u_buBdM0IvNl65Xd5hGDOIlm7L/view }}
Attach File from Google Forms
For this example, we have a Google Form with a file upload field. The respondent can fill in their name, country and upload a photo ID in either PDF or image format.
To embed the uploaded file in the email notification, add the Embed File
formula in the email template with the file upload question as shown below:
{{ Embed FILE, Photo Id }}
Attach Unique Files in Sheets
You can also send unique file attachments to email recipients who are listed in a Google Sheet, one per row.
Create a new column in the merge sheet and add a column titled File Attachments
that is used to determine which attachments should be sent to the email address specified in that row.
This column contains links to your files in Google Drive and you can also add multiple links separated by commas. The Document Studio add-on will fetch the corresponding files for each of these links from your Google Drive and attach them to the outgoing email.
Important Things to Know
-
The embed formula needs to be added in the body of your email message template.
-
You can add links to Google Docs, spreadsheets and slides in the Embed formula but these native files are converted to PDF before attaching.
-
Document Studio cannot attach files that are stored in Shared (Team) Drives.
-
You may also attach multiple files in the same email message by adding multiple file embed formulas with different file ids or file urls.