Created
November 30, 2022 09:55
-
-
Save phillypb/b4333491ef8296b5362847bccc823788 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function switchActiveView() { | |
// get spreadsheet | |
var ss = SpreadsheetApp.getActiveSpreadsheet(); | |
// get cell range in destination sheet that the view will be switched to | |
var range = ss.getRange('Sheet2!A1'); | |
// activate cell range so cursor moves to that position and changes the current view | |
range.activateAsCurrentCell(); | |
} | |
function onOpen() { | |
SpreadsheetApp.getUi() | |
.createMenu('Admin') | |
.addItem('Switch view', 'switchActiveView') // label for menu item, name of function to run. | |
.addToUi(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment