【发布时间】:2012-10-20 16:53:57
【问题描述】:
我正在电子表格上编写谷歌脚本。 我想将其部署为 Web 应用程序。 它显示了一些值。 不幸的是,用我当前的代码,谷歌提醒我:
TypeError:无法调用 null 的方法“getSheetByName”。
我不知道错误在哪里。
这是代码
function doGet(e) {
var app = UiApp.createApplication().setTitle('Details');
var ss = SpreadsheetApp.getActiveSpreadsheet().getSheets()[0];
var dataFromCell = ss.getRange("B4").getValue();
var mypanel = app.createVerticalPanel();
var label = app.createLabel(dataFromCell);
app.add(mypanel);
app.add(label);
return app;
}
【问题讨论】: