GAS HTMLService: opening a custom dialog (createTemplateFromFile ) when a cell changed

  Kiến thức lập trình

I’m just a beginner with Google Apps Script. I need help, I wrote some code that generates a dialog with some text and a drop-down menu that takes values ​​from the array, the problem is that the function needs to be activated when a cell changes. If the code is assigned to a button it works but if I associate it with a cell change it doesn’t work. this is the code:`

function showTest() {
 
  rigaStrEsatta = 11;
  numRisorse = 2;
  var values = arrayRisorsaMultlipla(rigaStrEsatta, numRisorse);
  var html = HtmlService.createTemplateFromFile("HTML_Test");
  html.arrayOfNames = values;
  SpreadsheetApp.getUi().showModalDialog(html.evaluate(),"Test");
}

html

<!DOCTYPE html>
<html>

<head>
  <base target="_top">
</head>

<body>
  <p>Please select the name that matches: name3</p>
  <select id="names" text="Select a name">
    <option selected disabled>Select a name</option>
    <? for(var i=0; i<arrayOfNames.length; i++){ ?>
      <option><?= arrayOfNames[i] ?></option>
    <?}?>
  </select><br><br>
  <button type="button" onclick="">OK</button>
</body>

</html>

the function should be associated with the change of a cell, but the custom dialog does not open.

New contributor

Federico Caselli is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.

Theme wordpress giá rẻ Theme wordpress giá rẻ Thiết kế website Kho Theme wordpress Kho Theme WP Theme WP

LEAVE A COMMENT