我正在尝试使用google Forms API。但是有一个参考错误

问题描述 投票:-1回答:1

我正在尝试使用Google Form 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

它应该什么都不做,但它会抛出异常。

javascript google-form referenceerror
1个回答
0
投票

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

screenshot

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

© www.soinside.com 2019 - 2024. All rights reserved.