1

我有一组从谷歌网站链接到的已发布仪表板。仪表板都是从谷歌电子表格中提取数据,它们是相当基本的——主要是可过滤的数据表。这是一个非常大的电子表格,有很多 vlookup 和一些导入范围、一些过滤器公式、一些查询公式……发生了很多事情……通常你会得到“一些公式需要一段时间来处理消息"

如果您打开了电子表格,仪表板就可以很好地工作。或者如果其他人打开它。但是,如果您关闭电子表格并等待一段时间,然后在电子表格关闭时尝试运行仪表板,则仪表板通常不会提取任何数据。

我怀疑我需要让仪表板等待数据加载更长时间,或者如果可能的话,以某种方式在“背景”中打开电子表格。有什么想法吗?这是我拥有的示例仪表板:

    function doGet() {

  var ss = SpreadsheetApp.openById("0Aq2VphSIvT4NdE1IRTlzV0NyWF9XZ1hsX2hXZG0xdHc");
  var lastrow = ss.getSheetByName('CIC Student Aggregate').getLastRow();
  var data = ss.getSheetByName('CIC Student Aggregate').getRange(1, 1, lastrow, 13);

  var StudentFilter = Charts.newStringFilter()
        .setFilterColumnLabel("Student Name")
        .build();
  var TotalsFilter = Charts.newNumberRangeFilter()
      .setFilterColumnLabel("Total Interactions")
      .build();

  var tablechart = Charts.newTableChart()
      .setDimensions(680, 550)
      .setDataViewDefinition(Charts.newDataViewDefinition()
                         .setColumns([0,1,7,8,9,10,11,12]))
    .build();   

    var piechart = Charts.newPieChart()
      .setDimensions(330, 350)
      .setDataViewDefinition(Charts.newDataViewDefinition()
                         .setColumns([0,12]))
      .build();  

  var dashboard = Charts.newDashboardPanel()
      .setDataTable(data)
      .bind([StudentFilter,TotalsFilter], [tablechart,piechart])
      .build();


  var uiApp = UiApp.createApplication()
      .setTitle("Interactions Totals")
      .setWidth(980)
      .setHeight(600);

 dashboard.add(uiApp.createVerticalPanel()
               .add(StudentFilter).add(TotalsFilter)
               .setSpacing(1)
    .add(uiApp.createHorizontalPanel()
        .add(uiApp.createVerticalPanel())
              .add(tablechart).add(piechart) 
        ));
  uiApp.add(dashboard);
  return uiApp;
}
4

1 回答 1

0

do you still have your problem ?

If it is the case, do you have some 'importrange' in your dashboard ?

If you read data with appscript on a range where the data is generated via importrange, it will return nothing if the spreadsheet is closed.

In fact, 'importrange' is triggered only when a user open a spreadsheet. Appscript doesn't trigger the 'importrange' on Spreadsheet opening.

于 2013-02-28T16:31:43.013 回答