我对 Apps Scripts 完全陌生,我正在尝试从 Google 电子表格中的 Apps Script 中创建一个简单的 TableChart。我不断收到“对象类型与列类型不匹配”错误,尽管尝试了我可以在网上找到的所有解决方案,但我无法弄清楚如何克服它。我的代码是:
function doGet() {
var ss = SpreadsheetApp.openById('0AkEJIKjP5Q4LdFh1ZjJOUF9BQ0J2YUNwVm50eGEyTEE');
var sss = ss.getSheetByName('Customer Updates');
var data = sss.getDataRange();
var referenceFilter = Charts.newCategoryFilter().setFilterColumnIndex(29).build();
var tableChart1 = Charts.newTableChart()
.setDimensions(900, 100)
.setDataViewDefinition(Charts.newDataViewDefinition().setColumns([29,1,28,30,48])).build();
var tableChart2 = Charts.newTableChart()
.setDimensions(900, 100)
.setDataViewDefinition(Charts.newDataViewDefinition().setColumns([31,32,33,34,36])).build() ;
var tableChart3 = Charts.newTableChart()
.setDimensions(900, 60)
.setDataViewDefinition(Charts.newDataViewDefinition().setColumns([37])).build();
var tableChart4 = Charts.newTableChart()
.setDimensions(900, 60)
.setDataViewDefinition(Charts.newDataViewDefinition().setColumns([38])).build();
var tableChart5 = Charts.newTableChart()
.setDimensions(900, 60)
.setDataViewDefinition(Charts.newDataViewDefinition().setColumns([39])).build();
var tableChart6 = Charts.newTableChart()
.setDimensions(900, 60)
.setDataViewDefinition(Charts.newDataViewDefinition().setColumns([40])).build();
var tableChart7 = Charts.newTableChart()
.setDimensions(900, 60)
.setDataViewDefinition(Charts.newDataViewDefinition().setColumns([41])).build();
var tableChart8 = Charts.newTableChart()
.setDimensions(900, 60)
.setDataViewDefinition(Charts.newDataViewDefinition().setColumns([42])).build();
var tableChart9 = Charts.newTableChart()
.setDimensions(900, 60)
.setDataViewDefinition(Charts.newDataViewDefinition().setColumns([43])).build();
var tableChart10 = Charts.newTableChart()
.setDimensions(900, 60)
.setDataViewDefinition(Charts.newDataViewDefinition().setColumns([44])).build();
var tableChart11 = Charts.newTableChart()
.setDimensions(900, 60)
.setDataViewDefinition(Charts.newDataViewDefinition().setColumns([45])).build();
var tableChart12 = Charts.newTableChart()
.setDimensions(900, 60)
.setDataViewDefinition(Charts.newDataViewDefinition().setColumns([46])).build();
var dashboard = Charts.newDashboardPanel().setDataTable(data)
.bind([referenceFilter], [tableChart1,tableChart2,tableChart3,tableChart4,tableChart5,tableChart6,tableChart7,tableChart8,tableChart9,tableChart10,tableChart11,tableChart12])
.build();
var app = UIApp.createApplication();
var filterPanel = app.createHorizontalPanel();
var chartPanel1 = app.createHorizontalPanel();
var chartPanel2 = app.createHorizontalPanel();
var chartPanel3 = app.createHorizontalPanel();
var chartPanel4 = app.createHorizontalPanel();
var chartPanel5 = app.createHorizontalPanel();
var chartPanel6 = app.createHorizontalPanel();
var chartPanel7 = app.createHorizontalPanel();
var chartPanel8 = app.createHorizontalPanel();
var chartPanel9 = app.createHorizontalPanel();
var chartPanel10 = app.createHorizontalPanel();
var chartPanel11 = app.createHorizontalPanel();
var chartPanel12 = app.createHorizontalPanel();
filterPanel.add(referenceFilter).setSpacing(7).setHeight(10);
chartPanel1.add(tableChart1);
chartPanel2.add(tableChart2);
chartPanel3.add(tableChart3);
chartPanel4.add(tableChart4);
chartPanel5.add(tableChart5);
chartPanel6.add(tableChart6);
chartPanel7.add(tableChart7);
chartPanel8.add(tableChart8);
chartPanel9.add(tableChart9);
chartPanel10.add(tableChart10);
chartPanel11.add(tableChart11);
chartPanel12.add(tableChart12);
dashboard.add(app.createVerticalPanel().add(filterPanel).add(chartPanel1).add(chartPanel2). add(chartPanel3).add(chartPanel4).add(chartPanel5).add(chartPanel6).add(chartPanel7).add(ch artPanel8).add(chartPanel9).add(chartPanel10).add(chartPanel11).add(chartPanel2));
app.add(dashboard);
return app;
}
var dashboard = Charts.newDashboardPanel().setDataTable(data) 行有错误
有任何想法吗?