I'm trying to learn how to manipulate with cell in Google spreadsheets with Google script. I have learned, that
Custom functions return values, but they cannot set values outside the cells they are in. In most circumstances, a custom function in cell A1 cannot modify cell A5. However, if a custom function returns a double array, the results overflow the cell containing the function and fill the cells below and to the right of the cell containing the custom function. You can test this with a custom function containing return [[1,2],[3,4]];
So I'm calling function in cell C14
function test(input){
var secondCell = SpreadsheetApp.getActiveSheet().getRange("C14").setValue("Ahoj");
return secondCell.getValue();
}
and still getting error
You do not have permission to call setValue
I can't even set data in cell from which I'm calling the function.
Does anybody know why is this not working ?
Edit:
I've read possible duplicate Why can't you use setValue in a custom function?
But this is not solving my problem.
I don't want to edit other cells. I only want to edit the original cell containing the formula. According the quoted text, I should be possible to edit cell, if it's original cell containing the formula. But my example is returning error even though it's accessing only itself.