The functions like setActiveSheet(), setActiveRange(), activateAsCurrentCell() will change the UI view, but only within the active user session in which the script is running, so you must use Spreadsheet.getActiveSpreadsheet(); rather than openById().
You can use these functions from a custom menu or onEdit trigger to change the active sheet in the UI from which they were triggered, but it won't impact other open copies of the sheet, for this or other users.
If you are attempting to trigger via another method, where the code isn't executing in the context of the current users session, you won't see any impact on the UI side.
/* this does not work */
function getByIDJumpByActive(){
var spreadsheet= SpreadsheetApp.openById('1u3d8Auoi3CJNqZgLiui2oKIB3FDYOwAHLq59zWY5fNk');
var sheet = spreadsheet.getSheetByName('Sheet3');
spreadsheet.setActiveSheet(sheet);
spreadsheet.toast('opened by id and jumped by active sheet');
}
/* the below all work within the active user session. */
function jumpByRange() {
var spreadsheet= SpreadsheetApp.getActiveSpreadsheet();
var range = spreadsheet.getRange('Sheet2!A1');
range.activateAsCurrentCell();
spreadsheet.toast('jumped by active cell');
}
function jumpByActive(){
var spreadsheet= SpreadsheetApp.getActiveSpreadsheet();
var sheet = spreadsheet.getSheetByName('Sheet3');
spreadsheet.setActiveSheet(sheet);
spreadsheet.toast('jumped by active sheet');
}
function onOpen(){
var doc = SpreadsheetApp.getUi();
var menu = doc.createMenu('Switch');
menu.addItem('by range','jumpByRange');
menu.addItem('by active','jumpByActive');
menu.addItem('get by ID and jump by active','getByIDJumpByActive');
menu.addToUi();
}
function onEdit(){
jumpByActive();
}
MainBoardSheet.activate();
for this? – ross