I can't manage to get by the permission error, this might work for you.
function onEdit(e) {
var sheet = SpreadsheetApp.getActiveSheet();
if (sheet.getName() == "Project"){ //Change to your sheet name
var sourceRange = e.source.getActiveRange();
var sourceRow = sourceRange.getRow();
var sourceColumn = sourceRange.getColumn();
var sourceValue = sourceRange.getValue();
if(sourceColumn == 1){ //Change to the column you want to get the value from
var noteCell = sheet.getRange(sourceRow, 2); //The cell where the Note should be, B-column on the current row
noteCell.setNote(sourceValue);
}
}
}
EDIT
I do believe this is what you want. The function above sets a note on the cell in the B-column on the current row, if the cell in the A-column is edited.
If you don't want the note to update with A1
you should be able to use the function you wrote, with a slight modification to get the value from A1
.
function noteSetter() {
var ss = SpreadsheetApp.getActiveSpreadsheet();
var sheet = ss.getSheets()[0];
var cell = sheet.getRange(2, 2);
cell.setNote(sheet.getRange(1,1).getValue());
}
function onOpen() {
var sheet = SpreadsheetApp.getActiveSpreadsheet();
var entries = [{
name : "Set cell note",
functionName : "noteSetter"
}];
sheet.addMenu("Scripts", entries);
};
I added a function to add the script to a Custom menu, to make it easier to access, if you don't want that you can just remove the onOpen
-function.