Google App scripts noob here. I am trying to send email from google sheets and I have a working code. However, the challenge I have unaddressed is to paste an image in the email before sending it. The image that needs to be pasted is copied from the snipping tool. In Microsoft Outlook, I have used .Show
function to preview the email and paste the image but I am unable to achieve the same in google app scripting. The image is different every time an email is sent and saving the image to a drive location defeats the automation effort so the preferred option is to paste the image before its sent. I would appreciate any suggestions and recommendations to make this happen. I am sure there is a way to do this and I am at the right place to find that way.
function SendNote() {
var active_range = SpreadsheetApp.getActiveSpreadsheet().getActiveRange();
var env_type = SpreadsheetApp.getActiveSheet().getRange(active_range.getRowIndex(), 1).getValue();
var count = SpreadsheetApp.getActiveSheet().getRange(active_range.getRowIndex(), 4).getValue();
var mail_type = SpreadsheetApp.getActiveSheet().getRange(active_range.getRowIndex(), 13).getValue();
// Check totals sales
if (mail_type = 'Kick_Off')
{
// Fetch the email address
var emailRange = SpreadsheetApp.getActiveSpreadsheet().getSheetByName("Sheet1").getRange("B2");
var emailAddress = emailRange.getValues();
// Send Email.
var message = 'This is my message ' + env_type; // Second column
var subject = 'This is the subject';
MailApp.sendEmail('myhandle@mymail.com', subject, message);
}
}