8
votes

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

6
Double check that there isn't a typo in the script name. I followed your instructions and used the same code. It worked just fine. - Rubén
No typos. I can't believe it's working for you! I still can't get it to go :/ - davecut85
Thanks, Ruben. This helped to spark an idea. I believe it's not finding the function because I am not the owner of the sheet. - davecut85
I've had this same issue and it turned out that the document owner had left their job and ownership rights had been moved to someone else. I'm not sure why this would matter, but we're using BigQuery so maybe this new owner doesn't have permissions or something, but yea that could be the issue - tomb

6 Answers

3
votes

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

1
votes

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").

0
votes

Try reloading the page.

Sounds like a simple 'turn it off and on again' fix but after having the same issue and trying to save a new version, renaming the function, creating new function etc. a page reload was all it took!

0
votes

I had exactly the same problem. Eventually I found the problem when I looked at the script Function name, which should be Function followed by the name you gave the script when it was created. when creating file names sometimes you are not able to use special characters which is what I had done. Once I gave it a name that had allowable characters there was no problem. In programming when you call a function that does not match the name given to the function or procedure you will end up getting the error function not found.

0
votes

I had the exact same issue, when I used submitdata , after I changed it to submitData it said it submitdata was deleted. so i put it back to original form and bam!! fixed.

0
votes

Another thing that can happen is that you have a library that has the same name as the function. For example you have imported a library that to refer to "test" in your code. If you name your function

function test(){
   your code
}

Then you will get the same error that you got. visual example of library with same name of a function