I created a function in the Apps Script associated with a spreadsheet:
function importNotes() {
s = SpreadsheetApp.openById('spreadsheet-key').getRange('F2').getNotes();
return s;
}
Note that the spreadsheet the function is attached to is not the one that the note is being read from. Both are owned by me.
When I step through the function in the debugger, it works, e.g., sets the local variable to [['This is a note']]
. (Of course, I use an actual spreadsheet key.)
When I put this in a cell in the associated spreadsheet:
=importNotes()
I get an error:
You do not have permission to perform that action. (line 3).
I've tried renaming the function to defeat caching and reloading the spreadsheet, but I continue to get the error.
How can I fix the permission problem?