23

Is it possible to mark a sheet as "Default" so that if anyone opens a Google Docs spreadsheet, the corresponding sheet is opened instead of the first one?

  • 2
    Not to my knowledge, but you can drag-and-drop the tabs so that you can put another sheet first. – Vidar S. Ramdal Dec 2 '13 at 8:13
20
  1. Each sheet has its own unique URL. When you click into a different sheet, the URL in your browser's address bar changes. Save it as a bookmark.
  2. The sheets at the bottom of your google-sheets are draggable. You can simply drag your preferred sheet such that it becomes the left-most sheet. (This is good because if you access your sheet from an Android device, it will open your preferred sheet by default.)

P.S. The code supplied by Jacob Jan Tuinstra will also accomplish what you are asking.

7

With the use of Google Apps Script you can do the following.

Code

function onOpen() {
  var ss = SpreadsheetApp.getActiveSpreadsheet();
  ss.setActiveSheet(ss.getSheets()[2]);  
}

Explained

The code will be triggered only upon opening of the file. The number between straight brackets is the sheet number you want to set default (zero based !!).

Example

I've created an example file (with some dates in it): Set Default Sheet

  • 2
    The example needs permissions to be viewed. Can you make it public so no one need permissions from you to view the same ? – Hari K T Aug 18 '17 at 5:33
  • @HariKT I've learned over time that making these examples files public, will result in chaos. – Jacob Jan Tuinstra Aug 19 at 7:30
  • Then wonder whether the example sheet link provided here have any use. Thank you. – Hari K T Aug 20 at 8:54
  • @HariKT You can make a copy of them and have full access to the code. – Jacob Jan Tuinstra Aug 20 at 12:51
  • You need permission Want in? Ask for access, or switch to an account with permission. Learn more This is what it will show, can't upload an image here. Else I would have done it. – Hari K T Aug 21 at 10:06
0

just remove the "gid=" value from the url and it will open the most recent sheet.

  • 1
    Removing the gid parameter and value will make that the leftmost sheet be opened as default when using the URL in a new tab or link. – Rubén Mar 17 '16 at 12:05
  • thanks that was exactly what I was looking for! – Markus Dec 3 '18 at 15:03
-1
function onOpen() {
  var ss = SpreadsheetApp
  ss.getActiveSpreadsheet().getSheetByName('Diário').activate();
}

or

function onOpen() {
  SpreadsheetApp.getActiveSpreadsheet().getSheetByName('Diário').activate();
}
  • 1
    Can you explain what the code is doing, please? – jonsca Jul 26 '16 at 22:18
-1

jonsca

Explaining Julio Mafra's code: both functions do the same work: when user open a Workbook and immediately after the workbook finished to be loaded, functions will set the sheet you selected by name (in the exemple 'Diário') as default.

the diferences between them are: function 1: more code lines because created a var; if you don't need to do any kind of operations with var ss, you can choose function 2 that has less lines and do the same work.

  • 2
    Thank you. I understand what the functions are doing, but I wanted the user to explain them in their answer. If you are the original author, you can merge your accounts (using the Contact Us link below) so you can edit the post. – jonsca Jul 27 '16 at 22:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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