function onChange(e) {
var ss = SpreadsheetApp.getActiveSheet();
var s = SpreadsheetApp.getActiveSpreadsheet().getSheetByName("Current");
var r = ss.getActiveCell();
if(e.changeType == 'FORMAT' && ss.getName() == "Current" && r.getBackground() == "#b7b7b7") {
var row = r.getRow();
var numColumns = s.getLastColumn();
var targetSheet = SpreadsheetApp.getActiveSpreadsheet().getSheetByName("Completed");
var target = targetSheet.getRange(targetSheet.getLastRow() + 1, 1);
s.getRange(row, 1, 1, numColumns).copyTo(target);
targetsheet.getrange(targetSheet.getLastRow() + 1, 2).setValue(getNotes(getrange(targetSheet.getLastRow() + 1, 16)))
s.deleteRow(row);
}
};
function getNotes(cell)
{
var ss = SpreadsheetApp.getActiveSpreadsheet();
var range = ss.getRange(cell)
return range.getNotes();
}
I'm using a third party add-on, onChange for my needs.
This function copies a row from one sheet to another when I color the row with #b7b7b7 and deletes it from the original sheet. However,
targetsheet.getrange(targetSheet.getLastRow() + 1, 2).setValue(getNotes(getrange(targetSheet.getLastRow() + 1, 16)))
does not seem to work. It should take notes from the second cell in the row and copy it to the 16th cell of the same row in the copied sheet. Help would be appreciated.