我正在尝试通过Google Apps Acript在Google Spreadsheet中插入新行。 我遇到了同样的错误-脚本已完成,但未返回任何内容。 没有插入新行。
我尝试了许多youtube教程。
我的应用脚本文件。
var ss = SpreadsheetApp.openByUrl("https://docs.google.com/spreadsheets/d/1m6KuS2Pk4_aL4LcNanWtApE4nFWxwJ4-vokETe-qfao/edit#gid=0");
var sheet = ss.getSheetByName("Items");
function doPost(e){
var action = e.parameter.action;
if(action == "Id"){
return addItem(e);
}
}
function addItem(e){
var date = new Date();
var Id = e.parameter.Id;
sheet.appendRow([date,Id]);
return ContentService.createTextOutput("Success").setMimeType(ContentService.MimeType.TEXT);
}
因此没有添加新行。 呼叫邮递员时,它会显示相同的消息
脚本已完成,但未返回任何内容。
邮差的链接为 https://script.google.com/macros/s/AKfycbzPtXN0xZ8A6M8j9zU3QnJo3T_q0-BWC3sJK0hB7_X_Knp9IM9_/exec
Jason的身体是 {“ action”:“ Id”,“ Id”:“ Id1”}
答案 0 :(得分:0)
尝试一下:
function doGet(e){
var action = e.parameter.action;
if(action=="Id"){
var ss=SpreadsheetApp.getActive();//you can open your spreadsheet however you wish but I find this easier if your web app is contained
var sh=ss.getSheetByName("Items");
var date= new Date();
sh.appendRow([date,action]);
return ContentService.createTextOutput("Success").setMimeType(ContentService.MimeType.TEXT);
}
}