简体   繁体   中英

Google Apps Script [MailApp] including multiple data

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 });
}

使用join()数组方法将数组连接成一个字符串:

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM