Send email from Google Spreadsheet omitting the commas

后端 未结 2 1999
逝去的感伤
逝去的感伤 2021-01-27 07:35

All,

I use a similar script to the below to send emails from a google spreadsheet:

// Sends an email when .......
function emailInfoRequired(row) { 
  va         


        
2条回答
  •  梦如初夏
    2021-01-27 07:46

    Range.getValues() returns a 2D array and a string representation of this 2D array is printed in your email. Depending on how you want to show it in your email, you have to process each element individually. Something like...

    function emailInfoRequired(row) { 
      var sheet = SpreadsheetApp.getActiveSpreadsheet().getActiveSheet();
      var subject = "Info Needed: " + sheet.getRange("F19").getValues();
      var recipients = "email@email.com"
      var values = sheet.getRange("K2:N2").getValues();
      var message = "" ;
      for (var row = 0 ; row < values.length ; row++){
        message +=  "

    " ; for (var col= 0 ; col < values[row].length ; col++){ message += "
    " + values[row][col]; } } message += ""; MailApp.sendEmail(recipients, subject, "", {htmlBody: message}); }

提交回复
热议问题