I'm working on creating a system for other teachers to easily track their students' progress. I've got a spreadsheet with individual sheets for each student and then a sheet for an overview of all students. The spreadsheet has the following script attached to it:
function SheetNames() {
try {
var sheets = SpreadsheetApp.getActiveSpreadsheet().getSheets()
var out = new Array( sheets.length+1) ;
for (var i = 1 ; i < sheets.length ; i++ ) {
out[i] = [sheets[i-1].getName()];
}
return out
}
catch( err ) {
return "#ERROR!"
}
}
function onOpen() {
var ui = SpreadsheetApp.getUi();
ui.createMenu('Student List')
.addItem('Update Student List', 'SheetNames')
.addToUi();
}
In the "Overview" sheet, I have a cell that just contains =SheetNames()
. When I first enter the custom function, the list populates. When I open the spreadsheet, the menu is added as it should be. However, when I click the menu item, the list of students on the "Overview" sheet is not updated. Is there anyway to make this function automatically update?
SpreadsheetApp.flush()
to theSheetNames()
function, at the bottom. Apps Script documentation – Alan WellsonEdit()
to make it auto update on every edit, and I've tried adding in a time-based event trigger. I cannot get this thing to update automatically. – Donald Brown