I have a very big Google Spreadsheet where there are some 30 sheets. Now I want to mantain links to each and every sheet on first sheet. So when I click on a link on the first sheet it should open a specific sheet.
Putting a Hyperlink will open the sheet in New Broswer Tab.
In Order to accomplish this follow the below steps.
Here is my sample sheet
Now I want to add a link on 'Index' sheet which when clicked should take me to the desired sheet.
Step 1 :
Goto Insert --> Drawing
Step 2 :
Type 2 , Resize it and click save and close
Position it properly on the sheet
Step 3:
Now click on 2 - you will see an arrow, click on it and select 'Assign Script'
Now type 'GotoSheet2' and click OK
Step 4:
Goto Tools --> Script Editor. If you see the below screen click 'Spreadsheet'. A script page is opened.
In the script window add the below code at the last line
function goToSheet(sheetName) {
var sheet = SpreadsheetApp.getActive().getSheetByName(sheetName);
SpreadsheetApp.setActiveSheet(sheet);
}
Once the above function is added now add your function 'GotoSheet2' assigned above and click Save
function GotoSheet2(){
goToSheet('Sheet2');
}
The final code snippet looks as follows.
Repeat the above process for each and every link.
function goToSheet(sheetName) {
var sheet = SpreadsheetApp.getActive().getSheetByName(sheetName);
SpreadsheetApp.setActiveSheet(sheet);
}
function GotoSheet2(){
goToSheet('Sheet2');
}
function GotoSheet3(){
goToSheet('Sheet3');
}
function GotoSheet4(){
goToSheet('Sheet4');
}
Here is the public link for the example project
https://docs.google.com/spreadsheets/d/19RZJkPWNQcgzlRYlkO9Z-UPaR9y6-h0NkXbhyZ6TmeA/edit?usp=sharing