Answer the question
In order to leave comments, you need to log in
How to make Google spreadsheet open in the right place?
Good afternoon!
I go to Google Sheets by bookmark, the desired sheet opens, but always at the beginning of the sheet. I would like the sheet to open in the same place where it was last closed. Or in the actual place, as it happens in excel. What do you advise?
Answer the question
In order to leave comments, you need to log in
function onEdit(e){
let row = e.range.getRow();
let column = e.range.getColumn();
let cache = CacheService.getScriptCache();
cache.putAll({
"row": `${row}`,
"column": `${column}`
});
}
function onOpen() {
let cache = CacheService.getScriptCache();
let sheet = SpreadsheetApp.getActiveSpreadsheet().getActiveSheet();
let row = cache.get("row");
let column = cache.get("column");
sheet.getRange(+row, +column).activate();
SpreadsheetApp.flush();
}
Put 2 triggers onedit and onopen.
During the first one, write the address of the active cell to the cache; while executing the second, go to the address of the active one. In order to avoid resources, you can write a script instead of onedit, which will be launched by hot keys, just press the key combination every time before exiting.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question