以编程方式发送 Google 表单的最直接方式

Most straightforward way to programatically send Google form

我用 google 应用程序脚本创建了一个 google 表单,并希望有另一个脚本我可以 运行 将表单发送到电子邮件地址列表。在表单编辑器中 UI 我可以(通过单击“发送”)输入电子邮件地址,相应的收件人会收到表单的 link。我如何以编程方式执行此操作?我希望有一个可用的方法,但在表单文档中没有类似的方法。

使用MailApp

在此处查看文档 - https://developers.google.com/apps-script/reference/mail/mail-app#sendemailrecipient,-subject,-body

MailApp.sendEmail("recipient@example.com",
                  "Subject",
                  "Content");

使用您的电子邮件列表,您可以执行以下操作:

listOfEmails.forEach(email => {
    MailApp.sendEmail(email,
                  "Subject",
                  "Please fill out this form: " + linkToForm);
})

其中 listOfEmails 是包含电子邮件地址的字符串数组,linkToForm 是您表单的 link 字符串。