Sometimes you have a large data set in Google Sheets with over ten thousands of records, you edit the cell in way bottom, close the sheet for a sleep, and reopen the sheet next day. Now the cursor is staying on the top left A1, you have no idea where you were. This article shares with you a simple Apps Script to remember your last edit cell position.
The apps script
/*
* @license
* The source code is subject to the terms of service in
* https://xfanatical.com/terms-of-service/#open-source
*
* @author xfanatical 2019
*/
function onOpen() {
var ss = SpreadsheetApp.getActiveSpreadsheet()
var rangePosition = PropertiesService.getUserProperties().getProperty('lastEditPosition')
if (rangePosition) {
rangePosition = JSON.parse(rangePosition)
ss.setActiveSheet(ss.getSheetByName(rangePosition.lastEditSheet))
ss.setActiveRange(ss.getRange(rangePosition.lastEditRange))
}
}
function onEdit(e) {
var range = e.range
var sheet = range.getSheet()
PropertiesService.getUserProperties().setProperty('lastEditPosition', JSON.stringify({
lastEditSheet: sheet.getName(),
lastEditRange: e.range.getA1Notation(),
}))
}
A demo
Remember last edit cell position in Google Sheets
DIY
Copy and paste the apps script to your Sheet's Tools > Script editor. This article explained in detail How To Add An Apps Script To Your Google Slides?
Thanks for reading.