Skip to main content
All CollectionsGetting StartedWriting Effective Cold Emails
📸How do you embed images from Google Drive Folder into your email sequence/campaign? (Image Personalization)
📸How do you embed images from Google Drive Folder into your email sequence/campaign? (Image Personalization)

This guide describes how to display images stored in Google Drive in your emails.

Yashal Vagadia avatar
Written by Yashal Vagadia
Updated over 7 months ago

Generate Google Drive Image Links

Step 1️⃣: Share Your Folder Links

Go to Google Drive, upload your image, add it to a folder, and right-click to get the shareable link.

Step 2️⃣: Open Access

In the sharing settings, choose "Anyone with a link" so everyone can see it. Copy the link.

Step 3️⃣: Navigate to Spreadsheet

Click "Extension" > "Apps Script" and paste in the provided script.

Script:

🚨Important: Replace Folder ID with the actual Google Drive folder link

Actual Link: https://drive.google.com/drive/folders/1DAcioympchL5PWUhKDLZPYc8XfrfysNY?usp=sharing

Folder id: 1DAcioympchL5PWUhKDLZPYc8XfrfysNY (Need to use this)

In your case, whatever the link generated is, you need to copy the folder ID and paste it inside the script.

function myFunction() {

var ss = SpreadsheetApp.getActiveSpreadsheet();

var s = ss.getActiveSheet();

var c = s.getActiveCell();

var fldr = DriveApp.getFolderById("Folder ID");

var files = fldr.getFiles();

var data = [];

while (files.hasNext()) {

var file = files.next();

if (isImageFile(file)) {

var fileName = file.getName();

var fileUrl = file.getUrl();

var fileId = getFileIdFromUrl(fileUrl);

var lh3Link = generateEmbedCode(fileId);

data.push([fileName, fileUrl, lh3Link]);

}

}


if (data.length > 0) { var numRows = data.length; var numCols = data[0].length; s.getRange(c.getRow(), c.getColumn(), numRows, numCols).setValues(data); }}
function isImageFile(file) { var type = file.getMimeType(); return type.indexOf("image/") !== -1;}
function getFileIdFromUrl(url) { var match = url.match(/[-\w]{25,}/); return match ? match[0] : null;}
function generateEmbedCode(fileId) { return 'https://lh3.googleusercontent.com/d/' + fileId;}

Step 5️⃣: Run the Script

Save and run the script in Google Sheets.

Step 6️⃣: Find Your URLs

Head back to your Google Sheet; your image URLs are ready. You need to use the link starting with https://lh3.googleusercontent.com/d/{{imageid}}

Step 7️⃣: Saleshandy Setup

Create a custom merge tag for your image URLs in Saleshandy.

For Image URLs to use in the campaign, you need first to create a custom merge tag. Checkout 🪄Custom Merge Tags(Custom Fields): What, Why, and How to Set it up?

Step 8️⃣: Use Your Merge Tag

When crafting your email, select your custom merge tag from the dropdown menu.

You've learned how to embed images from Google Drive into your email sequence/campaign.

Did this answer your question?