【问题标题】:I'am trying to use the google Forms API. But there is a reference error我正在尝试使用谷歌表单 API。但是有一个参考错误
【发布时间】:2019-04-05 12:52:52
【问题描述】:

我正在尝试使用 Google 表单 API。当我尝试使用FormApp.openByUrl() 时。但我收到了ReferenceError。这是我的代码:

我已经尝试过导入 API。但它没有用。

<html>
<head>
    <title>Test</title>
    <script src="https://apis.google.com/js/api.js"></script>
</head>
<body>
    <script>
        var form = FormApp.openByUrl('https://docs.google.com/forms/d/SOME-FORM/edit');
        var formResponses = form.getResponses();
    </script>
</body>
</html>

控制台输出:

Uncaught ReferenceError: FormApp is not defined
    at (index):9
(anonymous) @ (index):9

它应该什么都不做,但它抛出了一个异常。

【问题讨论】:

  • 错误信息和堆栈跟踪会很有用
  • 你必须包含正确的js文件
  • @DanielA.White 我从哪里得到它们??
  • 在这个 JS 文件中没有任何东西叫FormApp
  • @TheGreydiamond ¯_(ツ)_/¯ 你必须阅读文档

标签: javascript google-forms referenceerror


【解决方案1】:

您尝试使用的 API 用于通过脚本编辑器嵌入到 Google 表单中的脚本。

它与脚本https://apis.google.com/js/api.js 无关,该脚本用于连接其他网站的Google API。

【讨论】:

  • 感谢您的澄清。我已经很好奇为什么我找不到一些 CDN 来添加和测试 OP 的想法是否有效。
猜你喜欢
  • 1970-01-01
  • 2018-09-01
  • 1970-01-01
  • 1970-01-01
  • 2018-10-25
  • 2020-09-02
  • 2023-03-06
  • 2020-01-30
  • 1970-01-01
相关资源
最近更新 更多