使用Google Drive SDK在Google Spreadsheet脚本中激活触发器 [英] Activating Triggers in Google Spreadsheet Scripts with Google Drive SDK

查看:97
本文介绍了使用Google Drive SDK在Google Spreadsheet脚本中激活触发器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

换句话说,是否有办法:


  1. 创建一个新的Google电子表格(来自Google Drive API)
  2. >
  3. 然后以编程方式创建与Google Spreadsheet相关的Google Apps脚本
  4. 然后以编程方式激活On Edit和On Form Submit Triggers 在脚本中调用各种方法? (这是我找不到的部分)


    1. 使用所需脚本手动创建电子表格

    2. 使用Google Drive API以编程方式复制电子表格用脚本也可以)

    3. 以某种方式以编程方式激活On Edit和On Form Submit Triggers(不要复制复制电子表格,这是部分我找不到)
    4. 可能的路径如下:



      使用电子表格中的onOpen()触发器创建容器绑定脚本。



      复制现有的电子表格以编程方式复制脚本。



      以编程方式打开新的电子表格(不确定这是否会启动上述触发器)。



      这假设了几件事情,但似乎是值得的调查。我很好奇这是否有效。祝你好运。


      Phrased another way, is there a way to:

      1. Create a new Google Spreadsheet (from the Google Drive API)
      2. And then create a Google Apps Script associated with that Google Spreadsheet programmatically
      3. 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)

      -OR- (as @JacobFlatter suggested)

      1. Manually create a spreadsheet with the desired script
      2. Use the Google Drive API to programmatically copy the spreadsheet (which copies with script with it as well)
      3. 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)

      解决方案

      Possible path to follow:

      Create a container bound script with an onOpen() trigger within a spreadsheet.

      Copy the existing Spreadsheet (which will copy the script as well) programmatically.

      Open the new Spreadsheet programmatically (unsure if this will initiate the trigger described above).

      This assumes a few things, but seems like it is worth investigating. I'm curious if this works. Good Luck.

      这篇关于使用Google Drive SDK在Google Spreadsheet脚本中激活触发器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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