如何访问或致电“将此表格发送给其他人”? [英] How to access or call "Send this form to others"?

查看:92
本文介绍了如何访问或致电“将此表格发送给其他人”?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个附加到Google Apps电子表格的表格。这种表格可以让我的同事向我们的每周审核会议提交议程项目。我正在编写一个脚本,以自动通过电子邮件将提醒发送给相关人员。

I have a form attached to a Google Apps spreadsheet. It's a form to let my coworkers submit agenda items to our weekly review meeting. I'm writing a script to automatically email a reminder to the relevant people.

为了减少烦人&对于他们来说很乏味,我想将表格实际嵌入到电子邮件中。 Google文档提供了一种手动发送表单的方式:电子表格>表单>发送表单。但是,我在Google Apps脚本文档中找不到让我触发此功能的任何方法,例如

To make it less annoying & tedious for them, I'd like to actually embed the form within the email. Google Docs provides a way to manually send a form: Spreadsheet > Form > Send form. However, I can't find any way in the Google Apps Scripts documentation that lets me trigger this functionality, e.g.


  • 类似于sendFormInEmail

  • 访问电子邮件友好的表单HTML,我可以将其分配给 sendEmail方法

  • 在Google Apps中触发任意菜单项

  • 还有其他地方吗?
  • A method like sendFormInEmail
  • Access to the email-friendly form HTML, which I could assign to the htmlBody argument of the sendEmail method.
  • Trigger an arbitrary menu item in Google Apps
  • Something else?

我可以通过从电子邮件中提取生成的HTML并将其分配为htmlBody参数来解决此问题,但是我必须手动每次我们要更改表单时都更新html,而不是我想发生的事情。

I could do a workaround by extracting the generated HTML from an email and assigning it as the htmlBody argument, but then I'd have to manually update the html every time we want to make a change to the form -- not what I want to happen.

有任何建议吗?

推荐答案

Joris,您是对的。您可以使用方法fetch()将表单的html发送到用户的邮箱:

Joris, you're right. You can use the method fetch() to send the form's html to the user's mailbox:

var form = FormApp.create('New Form');
....
var url = form.getPublishedUrl();
var response = UrlFetchApp.fetch(url);
var htmlBody = HtmlService.createHtmlOutput(response).getContent();
    MailApp.sendEmail({
    to: email,
    subject: subject,
    htmlBody: htmlBody,
  });
...

这篇关于如何访问或致电“将此表格发送给其他人”?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆