Send Google Sheet content in Mail using App Script

  Kiến thức lập trình

I am trying to send mail using google App script to select particualr active sheet range content but every time i am running the script its showing error. The coden is given below:

function sendmail() {
  var sheet = SpreadsheetApp.getActiveSheet();
  var startRow = 5;  
  var numRows = 15;   
  var dataRange = sheet.getRange(startRow, 5, numRows, 15)
  var data = dataRange.getValues();
  var data = sheet.getRange ("C5:D15").getValues();
  var message = getTable(data);
  for (i in data) {
    var row = data[i];
    var emailAddress = row[0];  
    var message = sheet.getRange ("C5:D15");
    var subject = "Test Mail";
    MailApp.sendEmail({
     to: '[email protected]',
     subject: Feedback,
     htmlBody: message
 });
  }
}

Once we run the code the mail should be sent from app script by select the google sheet content from active sheet range

New contributor

Sanjay Kumar Marandi is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.

LEAVE A COMMENT