0

当单元格中的总支出超过一定数量并且我收到
TypeError: Cannot read property 'getValue' of null Checktotalspend @ Code.gs:6时,我正在尝试使用 Google 表格中的 appscript 发送电子邮件

 function Checktotalspend() {
  // Fetch the total spend number
  var ss= SpreadsheetApp.getActiveSpreadsheet();
  var spendsheet= ss.getSheetByName("mSOWProjects");
  var spendtotal = spendsheet.getValue("P1");
  // Check total spend
  //if (spendtotal > 100000){
    // Fetch the email address
   // var emailRange = SpreadsheetApp.getActiveSpreadsheet().getSheetByName("Summary").getRange("A49");
    //var emailAddress = emailRange.getValues();
  
    // Send Alert Email.
    //var message = 'The total spend is ' + spendtotal; // Second column
   // var subject = 'Tier 1';
    //MailApp.sendEmail(emailAddress, subject, message);
   // }
}
4

1 回答 1

0

在获得价值之前尝试给它一个范围。例如:varspendtotal = spreadsheet.getRange(row, column).getValue():

于 2021-12-11T01:17:58.150 回答