如何访问或调用“将此表格发送给其他人”?
我有一个附加到 Google Apps 电子表格的表单。这是一种让我的同事向我们的每周审查会议提交议程项目的表格。我正在编写一个脚本来自动通过电子邮件向相关人员发送提醒。
为了让它不那么烦人&对他们来说很乏味,我想将表格实际嵌入到电子邮件中。 Google Docs提供了手动发送表单的方法:电子表格>表格>发送表格。但是,我在Google Apps脚本文档中找不到任何可以让我触发此功能的方法,例如
- 像sendFormInEmail这样的方法
- 访问电子邮件友好的表单HTML,我可以将其分配给 sendEmail 方法。
- 触发 Google Apps 中的任意菜单项
- 还有其他吗?
我可以通过从电子邮件中提取生成的 HTML 并将其分配为 htmlBody 参数来解决此问题,但是每次我们想要更改表单时,我都必须手动更新 html - 这不是我想要的发生。
有什么建议吗?
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.
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.
- 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?
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.
Any suggestions?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
乔里斯,你是对的。您可以使用 fetch() 方法将表单的 html 发送到用户的邮箱:
Joris, you're right. You can use the method fetch() to send the form's html to the user's mailbox:
我有和你完全相同的要求,但不幸的是似乎没有 API 调用可以做到这一点。
我认为可能有效的方法(尽管我还没有实际尝试过)是使用 Spreadsheet.getFormUrl 方法获取表单 URL,然后使用 UrlFetchAp.fetch 获取电子表格表单的 HTML,然后使用该 HTML 作为电子邮件正文。
就像我说的,我不知道这是否行得通(尽管在纸面上它应该行得通!),但我很想知道它是否行得通!
I have the exact same requirement as you do, but unfortunately there doesn't seem to be an API call that does this.
What I think might work (though I have yet to actually try this) is to use the Spreadsheet.getFormUrl method to get the form URL, then use UrlFetchAp.fetch to obtain the HTML for the spreadsheet form, and then use that HTML as the e-mail body.
Like I said, I don't know if this will work (though on paper it should!), but I'd be very interested to know if it did!