Permission error executing function - works from script editor

60 views Asked by At

I'm using a script, largely derived from posts read here:

/**
*
* adds row under active cell
* @customfunction
*/

function ADDROW() 
{
var sheet = SpreadsheetApp.getActiveSheet(),
    r = sheet.getActiveCell()
        .getRow(),
   bVal = sheet.getRange(r, 5)
        .getFormulaR1C1();
sheet.insertRowAfter(r);
sheet.getRange(r + 1, 5)
    .setValue(bVal);
}

When I run the script from the editor, it works perfectly.

But when I call the function from the spreadsheet (using =ADDROW()), I get an error:

You do not have permission to call InsertRowAfter

I checked the script's permissions (thanks to another post) and found that it has:

  • AddRowsAndValues Has some account access, including Google Docs
  • AddRowsAndValues has access to:
    Google Docs
  • View and manage your spreadsheets in Google Drive Additional access
  • Connect to an external service

So it seems the permissions are correct. What am I missing?

0

There are 0 answers