如何从 Google 表格中的不同函数调用 Google 表单中的函数?

How do I call a function from a Google Form from a different function in Google Sheets?

我正在尝试 运行 在 Google Sheets 脚本编辑器的上下文中编写的函数调用在 Google Forms 脚本编辑器的上下文中编写的不同函数。这可能吗?

Google 张

function callForm() {
  /*something like this?*/
  formID.google.script.updateForm()
}

Google 表格

function updateForm() {
  does stuff
}

我知道我可以使用触发器来 运行 表单的脚本,但出于各种原因我想从 google 工作表脚本中执行此操作。

如果您想从不同的 Apps 脚本项目调用 Apps 脚本函数,可以使用方法 scripts.run. You only would need to fill the function parameter (and parameters if needed). To make that call you should use the URL Fetch Service。这种方法就像 Apps 脚本 API 是与您的项目无关的第三方一样工作,因此您应该处理 API 授权。