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.
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 < howmany; i++) {
MailApp.sendEmail(emails[i],subjects[i],{htmlBody: text[i]});
}