谷歌应用脚​​本错误" TypeError:无法调用方法追加行..)"

时间:2017-10-17 06:21:04

标签: google-apps-script

我是初中生,我是使用" Google App Script"的初学者。请帮助我使用这行代码,因为我一直在收到错误" TypeError:无法调用方法" appendRow"为null。 (第29行,文件"代码",项目" AS_Score")"。这是我的代码行:

function doGet(e){

  var ss = SpreadsheetApp.openByUrl("https://docs.google.com/spreadsheets/d/1gk1O4SkS09f96si3trbS0HcVRhXlQH5wc7LVCJ-xMus/edit#gid=0");
  var sheet = ss.getSheetByName("Sheet1");

  addUser(e,sheet);


}


function doPost(e){

  var ss = SpreadsheetApp.openByUrl("https://docs.google.com/spreadsheets/d/1gk1O4SkS09f96si3trbS0HcVRhXlQH5wc7LVCJ-xMus/edit#gid=0");
  var sheet = ss.getSheetByName("Sheet1");

  addUser(e,sheet);

}



function addUser(e,sheet) {

  var id = e.parameter.id;
  var name = e.parameter.name;
  var grade = e.parameter.grade;
  var subject = e.parameter.subject;
  var score = e.parameter.score;

  sheet.appendRow([id,name,grade,subject,score]);

}

如果我有任何错误,请帮助我,谢谢!

1 个答案:

答案 0 :(得分:0)

尝试将工作表的名称更改为:(“ Sheet1”);