Created
April 2, 2015 17:40
-
-
Save primaryobjects/2f1a55afa341458f08ab to your computer and use it in GitHub Desktop.
Google Spreadsheet script to remember the last edited cell position and automatically scroll to it when opening the document.
This file contains hidden or 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
// | |
// Remember Last Edited Cell Position in Google Spreadsheets | |
// | |
// Install: | |
// 1. Open spreadsheet in Google Drive. | |
// 2. Click Tools->Script editor. | |
// 3. Paste the contents of this file into the text field. | |
// 4. Click Run->install | |
// 5. When prompted for permission, click OK. | |
// 6. Click Run->install a second time. Done! | |
// https://productforums.google.com/d/msg/docs/WLRi5_t1X18/kwnAeHZO4g8J | |
// https://productforums.google.com/d/msg/docs/WLRi5_t1X18/fueOWl7Fc1IJ | |
function install() { | |
var ss = SpreadsheetApp.getActive(); | |
ScriptApp.newTrigger("myfunction").forSpreadsheet(ss).onEdit().create(); | |
} | |
function myfunction() { | |
var sheet = SpreadsheetApp.getActiveSheet(); | |
var sName = sheet.getName(); | |
var currentCell = sheet.getActiveCell().getA1Notation(); | |
ScriptProperties.setProperty("sheetName", sName); | |
ScriptProperties.setProperty("cell", currentCell); | |
} | |
function onOpen() { | |
var lastModifiedSheet = ScriptProperties.getProperty("sheetName"); | |
var lastModifiedCell = ScriptProperties.getProperty("cell"); | |
SpreadsheetApp.getActiveSpreadsheet().getSheetByName(lastModifiedSheet).getRange(lastModifiedCell).activate(); | |
} |
Works on computer but not on Android. Can you please provide a solution for Android Sheets App as well?
Can you please explain the code because it is not showing any desired output to get last edited cell.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
get message saying line 22 is deprecated.