1
我有一個使用Google Apps電子表格的程序,它將數據讀寫到電子表格中,但我希望gui自動使用電子表格中的數據進行刷新(如果在電子表格中更改了內容) 。我想用這個來創建一個在一臺計算機上可見的頁面,然後在另一臺計算機上他們點擊一個按鈕,它將增加來自另一臺計算機的數量。有沒有一種方法來自動刷新谷歌應用程序腳本語言中的網絡應用程序標籤?Google Apps腳本編寫Web應用程序自動刷新標籤
var dataByDepartment = {};
var departments = [];
var dataSs = SpreadsheetApp.openById(DATA_SPREADSHEET_ID);
var dataSheet = dataSs.getSheets()[0]
var data = getRowsData(dataSheet);
function doGet() {
var app = UiApp.createApplication();
app.add(app.loadComponent("GNWDataGui"));
app.getElementById('deathLabel').setText("gameDeaths: " + data[0].deaths);
app.getElementById('killLabel').setText("gameKills: " + data[0].kills);
return app;
}
function deathClickHandler(e) {
var app = UiApp.getActiveApplication();
var sheet = dataSs.getSheetByName('General');
data[0].deaths += 1;
app.getElementById('deathLabel').setText("Death: " + data[0].deaths);
setRowsData(sheet, data);
app.close();
return app;
}
function deathClickMinHandler(e) {
var app = UiApp.getActiveApplication();
var sheet = dataSs.getSheetByName('General');
data[0].deaths -= 1;
app.getElementById('deathLabel').setText("Death: " + data[0].deaths);
setRowsData(sheet, data);
app.close();
return app;
}
function autoRefreshHandler(e) {
var app = UiApp.getActiveApplication();
app.getElementById('autoRefreshButton').setText("Auto Refresh");
data = getRowsData(dataSheet);
app.getElementById('deathLabel').setText("gameDeaths: " + data[0].deaths);
app.getElementById('killLabel').setText("gameKills: " + data[0].kills);
app.close();
return app;
}