Get Sheet cell note value with Google Apps Script

google-apps-script, google-sheets

Solution

I needed to do this today and found your question but no answer. This is what I finally came up with. You can do this by setting up a function in the script editor named getNote.

function getNote(cell)
{
   var ss = SpreadsheetApp.getActiveSpreadsheet();
   var range = ss.getRange(cell)
   return range.getNote();
}

then in your spreadsheet enter:

=getNote("C4")

to get the note from cell C4. If you want it to be a reference that changes when you move around the cells, then reference it this way:

=getNote(Address(row(C4), column(C4)))

Word of caution: Notes don't trigger a refresh, so if a note is edited the cell does not pick up the new value right away

Problem

Is there a way to get the value of a cell note and display it in the cell next to it? I have a column C where some of the cells contain notes. I would like to get these note values and write each cell note in the cell next to it in column D. For example: if cell C4 has a note "No entry", I want to display "No entry" in D4.

Original source