Home > Net >  Is it possible to create Buttons with Google Apps Script?
Is it possible to create Buttons with Google Apps Script?

Time:04-07

I would like to have a list with Names and next to them a Button, that brings me to that Spreadsheet. But i dont want to create a Button for each one manually.

Otherwise i would create a Sidebar with a Dropdown.. but would prefer the first solution :)

Thank you

Now I just have a single Name with a Single Button

CodePudding user response:

Yes, you can insert images with Apps Script and use it as buttons. Use enter image description here

Code.gs

function onEdit(e) {
  try {
    if( ( e.value === undefined ) || ( e.value === "" ) ) return;
    if( e.range.getSheet().getName() === "SheetList" ) {
      if( e.range.getColumn() === 2 ) {
        e.range.setValue(false);
        e.source.setActiveSheet(e.source.getSheetByName(e.range.offset(0,-1).getValue()));
      }
    }
  }
  catch(err) {
    SpreadsheetApp.getUi().alert(err);
  }
}

Reference

  • Related