【发布时间】:2017-09-25 22:36:54
【问题描述】:
我正在尝试将信息发送到 Google Web 脚本(具体来说,发送一个包含要写入 Google 表格的信息的 JSON 对象),但我无法将 GET 和 POST 请求发送到我的 Google 脚本。
我正在使用 Node.js 和“请求”模块来发送请求,但我没有收到我的 doGet() 和 doPost() 函数应该返回的内容,而是收到了很长的 HTML 文件是不相关的,其中一些表示 404 错误。
举个例子:
Node.js
var request = require('request');
request("https://script.google.com/macros/s/my-web-script/exec", function (error, response, body) {
console.log(body);
});
谷歌网络脚本:
function doGet(){
textOutput = ContentService.createTextOutput("Hello World! Welcome to the
web app.")
return textOutput
}
我发布了网络脚本并让任何人都可以访问它。我不确定为什么这不起作用。
【问题讨论】:
标签: node.js google-apps-script