'How to trigger a script via clicking a cell

I have a google spreadsheet with many tabs and I'm trying to create a dynamic Index tab.

So far this is what I'm doing:

function jumpToSheet() {
   var ss = SpreadsheetApp.getActiveSpreadsheet();
   var sheet = ss.getSheetByName(ss.getActiveCell().getValue());
   SpreadsheetApp.setActiveSheet(sheet);
}

function populateList() {
  var sheet = SpreadsheetApp.getActiveSpreadsheet();
  var range = sheet.getRange("D:D");
  var sheets = SpreadsheetApp.getActiveSpreadsheet().getSheets();
  for (var i = 0; i < sheets.length ; i++){
    cell = range.getCell(i+1, 1);
    cell.setValue(sheets[i].getName());
  }
}

I create two images on my index sheet. One has assigned to it the jumpToSheet function, the other has populateList assigned to it.

I click the second image and it populates column D with a list of all the tabs. (just a one time thing or whenever a tab is added/removed)

To navigate, I select a tab by name in this column, then click the first image and it takes me there.

I have two issues with this:

How do I make it a one click action? Currently I have to click the cell containing the name of the tab I want to jump to then click the image. I'd like to just click the cell if possible. Or any other solution that will only require a single click.

How do I get back to the index tab with the keyboard? I know I can jump around with ctrl+shift+pageup/down or click the horizontal lines icon in the lower left and select the top tab. But this is a bit slow for me. Is there a shortcut to go back to the first tab? Or some other way to do it quicker (preferably with the keyboard)



Solution 1:[1]

You wont be able to do it with one click. At minimum 2 clicks. Make a menu with both commands, less clumsy than clicking images. You could put a gas service url using hiperlink() but even that requires 2 clicks to go to the link and will be slower than the menu option.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Zig Mandel