Is it possible to create macro buttons to navigate in Google Sheets?

I am creating a database in Google Sheets per the link below:

Database

I would like to add buttons like you can in excel where you can record a macro to navigate or open another sheet or perform a particular function. For example in my database, I could create a home page with buttons to open certain sheets. I could then hide all of the sheets and only have a home page.

Or, perhaps hide the query data in cell C2 in the 'Other Attendances' sheet and create a button to open up the query.

Is any of this possible in Google Sheets?


Solution 1:

Let's create a button to go to the left hand most page. Please select one of the right hand pages or push the + sign in the lower left to create one.

Here's the script:

function gotoMostLeftPage() {
  var ss=SpreadsheetApp.getActive();
  ss.setActiveSheet(ss.getSheets()[0]);
}

Now we need a button:

enter image description here

We can use insert/Drawing to draw an image of our drawing.

enter image description here

In this case I'm using a basic shape. You can add text if you like.

enter image description here

Now just save and close.

enter image description here

Drag the button to where you want it and click on the three buttons in the upper right. Select Assign script.

enter image description here

Copy the script name.

enter image description here

Paste it into the dialog and click ok.

Try clicking on the button and it should take you to the left most page unless you are already there.