【问题标题】:Filling Google Forms with Google Sheets使用 Google 表格填写 Google 表单
【发布时间】:2021-01-25 15:27:57
【问题描述】:

我有一个 HTML 表单,可以将其响应保存到 Google 表格中。该表单包含以下字段:

姓名:
电子邮件:
主题:
留言:

现在,我想要的是我想在收件人填写表格到“电子邮件”字段中提到的地址后立即自动向他/她发送一封感谢电子邮件。我不想使用 Google 表单作为后端,因为很难绕过“已记录的响应”确认页面。另外,避免 PHP 对我来说会更好!

有没有办法自动发送这些电子邮件?邮件格式如下:

From: <my email address>
To: <email address from the "Email" field in the spreadsheet>
Subject: Re: Submission Received

Hey <name from the "Name" field in the spreadsheet>!

Body of the mail

如果有办法绕过谷歌表单的确认页面,请告诉我!那也行!

【问题讨论】:

  • 你能详细说明一下吗??
  • 好的,谢谢...请尽快添加

标签: html forms google-apps-script google-sheets google-forms


【解决方案1】:

如果您在谷歌表格中有数据,那么您可以在那里处理您的自动化。我设置了this sample file,您可能可以将其作为数据集的基础。

从那里我将以下脚本附加到电子表格中。 然后您需要设置一个触发器,以某种固定的频率执行此脚本(5 分钟?1 分钟?)。我认为它应该完成你的目标。内置检查以确保不发送部分数据。

const ss = SpreadsheetApp.getActiveSheet();
const sentMessageColumn = ss.getRange("E:E").getColumn();
function regularProcedure(){
  var aCell = ss.getRange(ss.getLastRow(),sentMessageColumn)

  while(aCell.isBlank()){
    var eRow = aCell.getRow();
    
    if(!(ss.getRange(eRow,2).isBlank() ||
      ss.getRange(eRow,3).isBlank() ||
      ss.getRange(eRow,4).isBlank()))
      {
        var newMail = GmailApp.createDraft(
        ss.getRange(eRow,2).getValue(),
        ss.getRange(eRow,3).getValue(),
        ss.getRange(eRow,4).getValue());
        newMail.send();
        aCell.setValue(true);
        }      
      aCell=aCell.offset(-1,0);
  }
}

【讨论】:

  • 我有一个疑问:您在哪里添加了指定发送邮件的行?
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2016-03-21
相关资源
最近更新 更多