javascript - Msgbox if YES or NO -
this should super easy! code merely consists of message box yes or no choice. given choice, corresponding string written cell a1. see no problem compared google's script examples. missing?
function msgbox() { var ss = spreadsheetapp.getactivespreadsheet(); var s = ss.getactivesheet(); var answer = browser.msgbox("confirm", "does work?", browser.buttons.yes_no); //if user clicks yes if(answer === browser.buttons.yes) { //then enter yes cell a1 s.getrange("a1").setvalue() === "yes"; } else { //else enter no cell a1 s.getrange("a1").setvalue() === "no"; }; }
i have never used google app scripts, based on other programming experiences, feel
s.getrange("a1").setvalue() === "yes"; might problem. usually, '===' operator used compare 2 values.
'aaa' === 'aaa' --> return true in case, don't want set value?
s.getrange("a1").setvalue("yes"); is feel appropriate.
Comments
Post a Comment