Curl 气体-不工作,但POST工作

Curl 气体-不工作,但POST工作,curl,google-apps-script,Curl,Google Apps Script,我的脚本执行得很好,当我从编辑器运行脚本时,它能够从电子表格返回数据,但当我尝试使用cURL或Postman时,它失败了 我am能够发布一篇帖子来调用doPost(e),并根据给定的参数向我的电子表格中添加额外的一行。我希望能够发出GET请求来调用我的doGet(e)方法,该方法将电子表格中的行返回为JSON(我验证了doGet在编辑器中工作) 但是,当我尝试使用cURL或Postman发出GET时,我得到TypeError:无法调用null的方法“getRange”。 我很困惑,因为我根本没有

我的脚本执行得很好,当我从编辑器运行脚本时,它能够从电子表格返回数据,但当我尝试使用cURL或Postman时,它失败了

am能够发布一篇帖子来调用
doPost(e)
,并根据给定的参数向我的电子表格中添加额外的一行。我希望能够发出GET请求来调用我的
doGet(e)
方法,该方法将电子表格中的行返回为JSON(我验证了doGet在编辑器中工作)

但是,当我尝试使用cURL或Postman发出GET时,我得到
TypeError:无法调用null的方法“getRange”。

我很困惑,因为我根本没有在脚本中调用方法
getRange()
,所以我不知道这个错误是从哪里来的。我将电子表格键和工作表名称硬编码到脚本中进行测试,但仍然会出现相同的错误

我已经部署了这个web应用程序,这样它就可以用我的Google帐户执行,我允许
任何人,甚至是匿名的
访问脚本。我已经运行了一个设置函数来使用脚本授权我的帐户

这是我的电子表格的一部分

这是我的密码:

function doGet(e) {
var ss = SpreadsheetApp.openById("0AvXqpv9dPoVfdHRzRUkxMS1qVkpwaEJDSk44RXpZUVE");
var sheet = ss.getSheetByName("Clouds");

var rows = sheet.getDataRange();
var numRows = rows.getNumRows();
var values = rows.getValues();

var json = JSON.stringify(values);
Logger.log(json);

return json;
};

function doPost(e) {
var ss = SpreadsheetApp.openById("0AvXqpv9dPoVfdHRzRUkxMS1qVkpwaEJDSk44RXpZUVE");
//var sheet = ss.getSheetByName(e.parameter["sheetID"]);
var sheet = ss.getSheetByName("Clouds");

//Logger.log("sheetId: " + e.parameter["sheetID"]);
Logger.log("request: " + e);

//check if sheet exists, if not add sheet
if (sheet == null) {
  Logger.log("Creating new sheet...");
    //inserts sheet with specified ID, updates sheet var, appends a header row and then locks it
    ss.insertSheet(e.parameter["sheetID"]); 
    sheet = ss.getSheetByName(e.parameter["sheetID"]);
    sheet.appendRow(["ID","Coverage","Date", "Time", "Comments", "kWhr", "mL Water"]);
    sheet.setFrozenRows(1); 
}
//Append the 3 inputs to the sheet
//If statement takes care of whether the user is using the GET or POST functions, GET will have different parameter id's

if (e == null || e.parameter["id"] == undefined){
Logger.log("getting data");
return ContentService.createTextOutput("Successful GET");
//doPost(e);
}
else {
Logger.log("Appending row...");
sheet.appendRow([
  e.parameter["id"],
  e.parameter["coverage"],
  e.parameter["date"],
  e.parameter["time"],
  e.parameter["comments"],
  e.parameter["kwhr"],
  e.parameter["ml"]
]); 
}

//Returns a string to be displayed (If nothing is return you get a Google page saying the script worked and nothing was returned)
return ContentService.createTextOutput("Successfully Submitted. You may close the application"); 
}

刚刚发现我必须以不同的版本重新发布代码。现在一切都好了