Google Apps脚本将代码添加到文档的副本 [英] Google Apps Script add code to copy of a document

查看:126
本文介绍了Google Apps脚本将代码添加到文档的副本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在Google文档中创建了一个文档绑定脚本,允许我选择文档中某些文本的一部分。然后,当我点击我的菜单按钮时,它将制作一份仅含选定文本的复制文档。然后,脚本会共享复制的文档并通过电子邮件向与他们分享的人发送电子邮件。



我希望共享文档的用户能够阅读该文件,并通过表格发送回他的想法。所以他也会去一个自定义的菜单按钮,点击它,一个表格会弹出,他会用电子邮件给我发回邮件。



我知道该怎么做这在手动的Google Apps脚本中。我可以去复制的文件,只需添加该脚本。但是,我如何自动化这个?我查看了Google Apps脚本引用,但找不到任何内容。

解决方案

无法在脚本中嵌入脚本使用脚本。



您可以使用具有脚本的模板,复制它并将您的内容添加到该副本,而不是从头开始创建新文档。

根据文档内容,它可能非常简单或者稍微复杂一些,因为您必须依次添加每个元素。这里有几个例子:如何复制模板并从其他文档插入内容


I created a document bound script in Google Docs that allows me to select a part of some text in a document. Then when I click my menu button it will make a copied document with only the selected text in it. The script then shares the copied document and emails the person that it was shared with them.

I would like it to be possible that the user of the shared document is able to read that document, and send a message back via a form on what he thought about it. So he would also go to a customized menu button, click on it, a form would pop up and he would email me back with the text.

I know how to do this in Google Apps Script manually. I can go to the copied document and just add that script. But how do I automize this? I looked at the Google Apps Script references but could not find anything.

解决方案

It is not possible to embed a script in a document using a script.

You could use a template that has a script , make a copy of it and add your content to that copy instead of creating the new doc from scratch.

Depending on the document content it might be very simple ...or just a bit more complex since you will have to add each element in turn. There are a few examples of this process here: How to copy a template and insert content from another document? :

这篇关于Google Apps脚本将代码添加到文档的副本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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