在 doGet(e) 上将参数传递给 webapp

use*_*225 3 google-apps-script

我试图弄清楚 URL 中的参数如何传递给doGet()函数。我尝试做

https://script.google.com/a/macros/[my domain].com/s/[some random string generated by GAS]其次是"&variable=data"

但它只给了我这个错误: “抱歉,您请求的文件不存在。”

仅供参考,https://script.google.com/a/macros/[my domain].com/s/[some random string generated by GAS]无需使用即可正常工作"&variable=data".

Phi*_*zak 6

要将 GET 参数添加到 URL 末尾,您需要使用?.

所以你的网址应该是这样的

http://script.[.......]/exec?variable=data&otherVariable=otherData
Run Code Online (Sandbox Code Playgroud)

另外,请确保发布您的应用程序以获得此功能。文件 > 管理版本。发布 > 发布为 Web 应用程序...