Home > front end >  Is it possible to present the list of resources from Google sheets - one below the other, in an emai
Is it possible to present the list of resources from Google sheets - one below the other, in an emai

Time:11-09

Link to Gsheet (refer Cols G-H) - enter image description here

Current Output: enter image description here

CodePudding user response:

In Code.gs, replace all \n newline characters in row[name1] to <br>:

data.forEach(function(row){
    // Add this line:
    row[name1] = row[name1].replace(/\n/g, "<br>")

    emailTemp.level2names = row[name1]; 

    var htmlMessage = emailTemp.evaluate().getContent();
    GmailApp.sendEmail(
      row[name1],
      "Trial Output!",
      "Your email doesnt support HTML",
      {name: "Vish", htmlBody: htmlMessage}
    );
  });

And change your scriptlet type to force printing:

<!-- Add the ! character after the ? -->
<?!= level2names?>
  • Related