Open Sheet to Last Used Tab / Range

Using onEdit, onOpen, and the Properties Service to open a Sheet to the last used tab and/or range
Important notes:
* Remember not to manually run the onEdit or onOpen functions – they will run automatically whenever the Sheet is edited or opened
* The Properties Service can only hold strings, so we have to use other Apps Script functions to convert the tab name string and range string into an actual tab and range value

Sheet (to copy from File then Make a copy):

function onEdit(e){

function onOpen(){
let sh = SpreadsheetApp.getActive();
let sheetName = PropertiesService.getScriptProperties().getProperty(‘lastOpenTab’);
let r = PropertiesService.getScriptProperties().getProperty(‘lastOpenR’);
let ss = sh.setActiveSheet(sh.getSheetByName(sheetName));

Connect with me:
• Twitter @FarrisSpencer
• Google Product Expert

Leave a Reply

Your email address will not be published. Required fields are marked *