Home > OS >  How to create button to go to certain sheet in google sheets?
How to create button to go to certain sheet in google sheets?

Time:11-24

I want to create a script for a button in google sheets so that when I press it, it will take me to a specific tab within that workbook

i.e. the first tab will be a contents page with buttons to take me to certain tab in that google sheet

Please bear in mind I do not know how to write scripts but can create buttons

TIA

CodePudding user response:

Try this simple script and assign it to a button if this works for you.

function goToSheet() {

var name = "Sheet1"; //change this code to set the sheet name
var sheets = SpreadsheetApp.getActiveSpreadsheet();
var sheetname = sheets.getSheetByName(name);
sheets.setActiveSheet(sheetname);

}

NOTE:

You would need to manually indicate the name of the sheet on the name variable, and it does not automatically update when you renamed a specific tab on your sheet.

CodePudding user response:

Another complete solution ...

code .gs

// mike.steelson
function onOpen(e) {
  SpreadsheetApp.getUi()
    .createMenu('           
  • Related