Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Google Sheets - Script function could not be found

I am working to link an image in my Google Sheet document to a specific cell in another tab. I'm doing this by building a simple function that will do this. However, when I assign the function and then click on the image, I then get the error "Script function "test" could not be found". When I run the function in the script manager interface, it works fine. It's when I try to actually use it in the sheet with the image.

Function Script:

function test()
{
  var ss = SpreadsheetApp.getActiveSpreadsheet();
  var sheet = ss.getSheetByName("TX Marketing Data");
  sheet.setActiveRange(sheet.getRange("A91"));
};

enter image description here

Steps to recreate:
1) Create image
2) Go to image, right click, go to drop down and select "Assign Script"
3) Enter "test" as the assign script

like image 635
davecut85 Avatar asked May 19 '16 21:05

davecut85


2 Answers

Remove ";" at the end of your function (after }).

like image 124
Amir Avatar answered Sep 17 '22 15:09

Amir


Had a similar problem and just solved it.

When assigning a script function to a button make sure to call the specific function name(i.e. "getWeatherData") and not the App Script name (i.e. "WeatherAPI").

like image 24
Aaron Alex Vargas Avatar answered Sep 16 '22 15:09

Aaron Alex Vargas