1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
| var PROP_NAME = "lastSheetIdx";
var userProperties = PropertiesService.getUserProperties();
function didSwitchSheets(from, to) {
Logger.log("Switched from " + from + " to " + to);
// Your code here
}
function timedEventHandler() {
var currentSheetIdx = SpreadsheetApp.getActiveSheet().getIndex()
var previousSheetIdx = parseInt(userProperties.getProperty(PROP_NAME));
if (currentSheetIdx !== previousSheetIdx) {
didSwitchSheets(previousSheetIdx, currentSheetIdx);
userProperties.setProperty(PROP_NAME, currentSheetIdx);
}
} |
Partager