title: Google Apps Script Spreadsheet Comment Automation
body: <p>Today I have a question about Google Apps Scripts, specifically for <em>Spreadsheets</em>. I've already looked at the documentation <a href="https://developers.google.com/apps-script/class_range">here</a> (yes, documentation on a <em>Sheet</em> within a Spreadsheet), but I haven't been able to find what I'm looking for. Here's the sitch:</p>
  
  <p>1.) When a cell is edited in a Google Spreadsheet, the function I have SETS a <em>NOTE</em> using the function (yes it says <em>cell.setComment()</em>, but in reality it creates a Note. Thanks for being consistent, Google!):</p>
  
  <pre><code>function onEdit() {
  var doc = SpreadsheetApp.getActiveSpreadsheet();
  var sheet = doc.getActiveSheet();
  var cell = sheet.getActiveCell();
  cell.setComment("Last modified: + (new Date()));
  }
  </code></pre>
  
  <p>2.) Notes have been 'replaced' by <em>Comments</em> as of... September 5th, 2012? Maybe? I would rather use those instead.</p>
  
  <p>3.) For both types of 'cell notation', there exist functions only to <em>SET</em> the Note/Comment, and not <em>ADD</em> (according to the documentation).</p>
  
  <p>4.) I would like to reference or write a function that has the capability to ADD a new Note/Comment (preferably Comment, they are more easily read), instead of setting the Note/Comment.</p>
  
  <p>5.) You can MANUALLY add a Note/Comment through the GUI in the Spreadsheet itself (right-click a cell and select "Insert Note" or "Insert comment". Because these right-click functions exist leads me to believe that we could write a script to do the same thing, but have it be called auto-magically when the cell has been edited.</p>
  
  <p>6.) This function will be used to keep track of cell revision history. I know that I can create a new spreadsheet and send the revision history to that new spreadsheet easily, but considering that I have 10 spreadsheets that need to be tracked, I would rather not have 10 new spreadsheets to keep track of history. Keeping it in the same spreadsheet will keep things simple.</p>
  
  <p>If anyone could help me out, it would be greatly appreciated!</p>