I'm trying to open a new sheet in my spreadsheet and set some values inside it, using google apps script. When calling the function, I provide one argument, which will be used to name the new sheet.
When I call the function in the sheet itself, it looks like that:

Unfortunately, I get an error saying I don't have the permissions to call the 'insertSheet()' function, although I already gave it permissions. Also, when running the same function from the script editor, it works fine, and the new sheet is being added.

I thought it might be some permissions problem, but I see no sense in that, since I already granted those permissions. The script was created through the sheet itself, so it should be bounded correctly.
Any idea of what am I missing? Please help :)