I would like that when I open any of my google spreadsheets the cursor be stepped on the last working cell (to remember the last position). Is this possible?
Thank you
You can create a trigger that runs every time your spreadsheet is opened.
This can probably be written more concisely but this would be the simplest idea, saving your row and cell properties upon each edit, and then setting them on open. Visit the Properties Service page to get some more info on which users can access those properties.
This will return to the last cell edited, not the last cell where the cursor had been.
Tools → Script editor and paste the following:
function onEdit(e) {
var ss = e.source
var sheet = ss.getActiveSheet();
var cell = ss.getActiveCell();
var row = cell.getRow();
var column = cell.getColumn();
var sheet_name = sheet.getSheetName();
var scriptProperties = PropertiesService.getScriptProperties();
scriptProperties.setProperty('row',row);
scriptProperties.setProperty('column',column);
scriptProperties.setProperty('sheet name',sheet_name);
}
function onOpen(e) {
var properties = PropertiesService.getScriptProperties();
var ss = e.source;
var sheet_name = properties.getProperty('sheet name');
var sheet = ss.getSheetByName(sheet_name);
var row = properties.getProperty('row');
var column = properties.getProperty('column');
var cell = sheet.getRange(row,column);
ss.setActiveSheet(sheet);
ss.setActiveRange(cell);
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With