title: Sending mail with HTML body using for in Google Apps Script
body: <p>I'm making a very basic mail merge from Google Sheets using Google Apps Script. I have text that needs to be presented as html, but when it sends the message body has '[object Object]' rather than the HTML content.</p>
  
  <pre><code>function test(){
  var ss = SpreadsheetApp.getActiveSpreadsheet();
  var howmany = ss.getRangeByName("howmany").getValue();
  var emails = ss.getRangeByName("email").getValues();
  var subjects = ss.getRangeByName("subject").getValues();
  var text = ss.getRangeByName("text").getValues();
  
  for (var i = 0; i &lt; howmany; i++) {
  MailApp.sendEmail(emails[i],subjects[i],{htmlBody: text[i]});
  }
  </code></pre>