title: google apps script: setNote() from the cell itself
body: <p>I'd like to set note from a cell—the note should be set to the same cell.</p>
  
  <p>I tried this function</p>
  
  <pre><code>function setNote(note){
      var note = note;
      var cell = SpreadsheetApp.getActiveSheet().getActiveCell();
  
      if(note == ""){
          cell.clearNote();
      }else{
          cell.setNote(note);
      }
  }
  </code></pre>
  
  <p>but got error <code>You do not have permission to call setNote (line 8)</code>, which is obvious, because I can’t edit any cell with a ‘cell function’ (a function that is input/typed in a cell rather than a GAS/JavaScript function itself).</p>
  
  <p>Is there a way to set note from the cell itself (using a ‘cell function’)?</p>
  
  <p>I’d like to be able to set cell value (which I already can) <em>and</em> note (which I can’t yet) from within a cell, like '=if(d4=4, e4, "") &amp; setNote(b4)` … or something like that.</p>