Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/google-apps-script/6.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/google-sheets/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Google apps script Google脚本CardService.newButtonStation()正在变为null_Google Apps Script_Google Sheets - Fatal编程技术网

Google apps script Google脚本CardService.newButtonStation()正在变为null

Google apps script Google脚本CardService.newButtonStation()正在变为null,google-apps-script,google-sheets,Google Apps Script,Google Sheets,在附加到Google电子表格的脚本中,我有一个用于启动/停止脚本的自定义菜单项。根据存储在别处的实际状态,我希望更改提示窗口。一个问题是,CardService.newbuttstation()似乎正在变为null,因此添加按钮会导致错误 var state = true //Comes from DocumentProperties var onButton = CardService.newTextButton().setText("Spustit") var offButton

在附加到Google电子表格的脚本中,我有一个用于启动/停止脚本的自定义菜单项。根据存储在别处的实际状态,我希望更改提示窗口。一个问题是,
CardService.newbuttstation()
似乎正在变为null,因此添加按钮会导致错误

  var state = true //Comes from DocumentProperties
  var onButton = CardService.newTextButton().setText("Spustit")
  var offButton = CardService.newTextButton().setText("Pozastavit")
  var cancelButton = ui.Button.CANCEL
  var buttonSet

  if (state == "true"){
    msg = "Do you want to stop the scripts?"
    title = "Automatic update is on"
    // Here I get the error: "Cannot find method addButton(Button)"
    buttonSet = CardService.newButtonSet().addButton(offButton).addButton(cancelButton)
  } else if (state == "false"){
    msg = "Do you want allow the scripts"
    title = "Automatic update is off"
    buttonSet = CardService.newButtonSet().addButton(onButton).addButton(cancelButton)
  } else {
    msg = "Do you want to switch automation on or off?"
    title = "Automation"
    buttonSet = CardService.newButtonSet().addButton(onButton).addButton(offButton).addButton(cancelButton)
  }
你有提示吗,怎么了?

来自

目前,您只能使用此服务构建Gmail附加组件


非常感谢。我没想到原因这么简单。@JTV请结帐