换句话说,有没有办法:
-
创建新的Google电子表格(来自Google Drive API)
-
然后以编程方式创建与该Google电子表格相关联的Google Apps脚本
-
And then programmatically activate the "On Edit" and "On Form Submit Triggers" to call various methods in the script? (this is the part I cannot figure out)
-
或 - (如@JacobFlatter建议)
-
使用所需脚本手动创建电子表格
-
使用Google Drive API以编程方式复制电子表格(带有脚本的电子表格也随之复制)
-
Somehow programmatically activate the "On Edit" and "On Form Submit Triggers" (which DO NOT copy over from copying the spreadsheet, this is the part I cannot figure out)
2 回答
可能的路径:
使用电子表格中的onOpen()触发器创建容器绑定脚本 .
以编程方式复制现有的电子表格(也将复制脚本) .
以编程方式打开新的电子表格(不确定这是否会启动上述触发) .
这假设了一些事情,但似乎值得研究 . 我很好奇这是否有效 . 祝好运 .
很不幸的是,不行 . 您无法使用Apps脚本进行元编程 . 根据this question的答案,我写了一个简单的函数来尝试元编程
它引发了一个错误,说
Invalid mime type