I was playing with Apps Script to try and add the value of a cell in a specific column (C4:C14) in my spreadsheet to cell C15 when there is a Note that says 'paid'
I read through the documentation of Class Range and was able to get the values of the notes, as well as the value of the cells in cell range (C4:C14), but I am unable to set the sum based on the contents of the Insert Note on Google Sheets.
Here is the code I worked out so far as well as the screenshot of my sheet.
function getPaid () {
var ss = SpreadsheetApp.getActiveSpreadsheet();
var sheet = ss.getSheets()[0];
var range = sheet.getRange("C4:C14");
var rangeval = range.getValues();
Logger.log(rangeval);
var comments = range.getNotes();
for (var i = 0; i > range.length; i++) {
if ( range.getNotes()[i] === "paid" ) {
sheet.getRange('C15').setValue(0 + rangeval[i]);
}
Logger.log(range.getNotes[i]);
}
Logger.log(comments);
}