0
votes

i have a groupList array that stores different data in each array. I'm wondering how to send a compiled list of data from groupList. I could go the long way of just doing groupList[1], groupList[2]...etc ..but my groupList is pretty huge. My code below won't work since it doesn't allow for loops in 'object' parameters.

MailApp.sendEmail(      
    "john@doh.com",
    "Generated Report " + new Date(),     // header
    "", // body    
    {htmlBody:
    for (i = 0; i < groupList.length; i++) { // <-- Syntax error
    groupList[i];
  }
    , attachments: chart });
}
1

1 Answers

2
votes

Use join() array method to concatenate your array into a string:

htmlBody: groupList.join("<br>")