Reputation: 127
I created a google apps script for Google Sheets with some simple custom functions. But when I Test the Deployment as an Add-on to a test Sheet. The custom functions don't work in the test sheet. Here are the steps I'm following:
Here's a link to the google sheet that contains the script: https://docs.google.com/spreadsheets/d/1lE-zvkxDZbjU1RU03CSZLywzv7gN6Ui3vWsRP5O4EeA/edit?usp=sharing
Here's a link to the test sheet: https://docs.google.com/spreadsheets/d/1SHcoNxtTLx74JqOnyVc8fqi5XRY2qFKMIvD39D5j5ss/edit?usp=sharing
code:
function onInstall(e){
onOpen(e);
}
function onOpen(e) {
SpreadsheetApp.getUi().createAddonMenu()
.addItem('Info', 'showInfo')
.addToUi();
}
function showInfo(){
var ui = SpreadsheetApp.getUi();
ui.alert("Fun with Custom Geometry Functions","This are some fun custom math
functions",ui.ButtonSet.OK);
}
/**
* Calculates the area of a circle.
* @param {number} radius of the circle.
* @return The area of a circle.
* @customfunction
*/
function AREAOFCIRCLE(radius) {
return 3.14159265359 * radius * radius;
}
/**
* Calculates the perimeter of a circle.
* @param {number} radius of the circle.
* @return The perimeter of a circle.
* @customfunction
*/
function PERIMETEROFCIRCLE(radius) {
return 2 * 3.14159265359 * radius;
}
Upvotes: 2
Views: 560
Reputation: 50774
I can confirm the issue. This is probably due to the fact custom functions run in their own auth mode AuthMode.CUSTOM_FUNCTION
. In any case, this seems to be a known issue:
https://issuetracker.google.com/issues/36763437
Click +1 on the top of the page to let Google developers know that you're affected.
Click documentation feedback here https://developers.google.com/apps-script/add-ons/how-tos/testing-editor-addons to update documentation
Upvotes: 3