1

If I have a Google Sheets link that ends in /edit or /edit#gid=0, it opens to the leftmost sheet. I'm looking for the opposite.

I know how to link to a specific sheet (/edit#gid=[ID number here]), but in this case, new tabs are added to the right. Is there some way to link to the rightmost sheet, whatever that may happen to be at the time of clicking the link, not at the time of linking?

1 Answer 1

1

There aren't "anchors" for opening sheets based on their position, by the way,

  • /edit opens the first sheet
  • /edit#gid=0opens the default sheet, no matter of it's position

One workaround might be to use an on open trigger to activate the last sheet when the spreadsheet is opened but it only works for the spreadsheet owner and editors.

To learn about the basics of using Google Apps Script to automate Google Sheets and about triggers, please checkout the following official guides:

This code use a simple onOpen trigger

function onOpen(e){
  const sheets = SpreadsheetApp.getActiveSpreadsheet().getSheets();
  if(sheets.length > 1) sheets.slice(-1)[0].activate();
}

Related

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.