Google表单通知:如果已编辑表单,则通过电子邮件发送特定单元格中的文本

时间:2017-01-22 17:41:08

标签: email notifications google-sheets

是否可以在更新引用特定单元格的工作表时发送通知?

我想引用的单元格,比方说C15,是静态的,包含文本。

因此,当提交表单/更新电子表格时,会收到一封电子邮件,上面写着" VA电子表格已更新:您的增值明显低于/高于本月的平均值。"从单元格C15中获取此文本。

由于

塔迪

1 个答案:

答案 0 :(得分:1)

此代码应该通过电子邮件向您发送从表单计算的详细信息。

/* Paste the below code in your spreadSheets Tools > ScriptEditor
Then setup trigger for on onFormSubmit in ScriptEditor
Resources > Current Project Triggers > Add New Triggers > from Spreadsheet > on Form Submit

Remember to change the "Your email ID here" to email ID you need the mail to send the email 
*/
    function emailMileage() {
      var ss = SpreadsheetApp.getActive();
      var sheet = ss.getSheetByName("Update");

    var userEmail = "your Email ID here"
    var sendername = "Mileage App"
    var subject = "Your Mileage:";
      if(sheet != null){
       // This combines the values from three cells in update sheet with a space  
       var message = sheet.getRange(1,1,3,1).getValues().join(" ");

      } else {
        var message = "Unable to find update Sheet!" 
      }

      MailApp.sendEmail({
        to: userEmail,
        name: sendername,
        subject: subject,
        htmlBody: message
      });



    }