When you are building a toolkit or a dashboard in Google sheets you have came across a situation where you want to navigate from one google sheet to another on a button click. Here in this post we will see how you can navigate or move from one google sheet to another using Google Apps Script (GAS).
Code to navigate/move from one google sheet to another using Google Apps script:
function NavigatefromOneSheettoAnother() { //Its a container bound script. Activating the active spreadsheet var spreadsheet = SpreadsheetApp.getActive() //Replacing the Sheet_name with the respective name to which you want to navigate on a click. spreadsheet.setActiveSheet(spreadsheet.getSheetByName('Sheet_name'), true); }
Here in the above code we are activating the spreadsheet that we are using and inside which we are writing container bound script. After that, we are passing the sheet name as argument inside the .setActiveSheet() function which will activate the respective on a click.
Now once you create the script, just go to the image which you want to use as a button and assign the function name to that image, by right clicking to the image and clicking on the three dots icon on top right and choose assign script.
That’s it now, just click and see the magic.
To get more detailed knowledge about Google Apps Script, you can check the official website. Also if you want to explore more codes/posts related to Google Apps Script on our website, then you can find it here.
If you have any questions or if you need any help please get in touch with me using the comment section below.
Leave a Reply