Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ALL Custom Functions return "unknown function" in one spreadsheet, but work in others

I have a few Simple Custom Functions that I use all the time. I have recently run into a spreadsheet that I desperately need to use them in, but when I try to use even the most basic custom functions, I get "#NAME?" with a hover text of "unknown function".

Even deleting all other code, and trying just this simple function, doesn't seem to work:

function double(d) {
  return 2*d;
}

When I duplicate the spreadsheet, the code that comes with it DOES work.

A few Notes:

  1. This is a Google Apps for Enterprise account.

  2. I was originally not the owner on this spreadsheet, but have since become the owner, thinking that this might be the cause.

  3. The spreadsheet originally had protected regions, which have since been removed, thinking that this might be the cause.

This spreadsheet is shared with hundreds of people, so I really want to find the root cause and fix it.

Any thoughts?

like image 499
Bob Wold Avatar asked Jun 16 '15 21:06

Bob Wold


People also ask

Is there an IF ELSE function in Google Sheets?

Google sheets IF Else statements consist of a condition that needs to be evaluated, a corresponding action if the condition is met, and another specified action if the condition is not met.

What is the LAMBDA function in Google Sheets?

Lambda helper functions (LHFs) are native functions which accept a reusable LAMBDA as an argument along with an input array(s). They help in advanced array-operations by executing the formula specified inside the LAMBDA , on each value in the input array.


2 Answers

Way too late for the OP, but in case this helps someone else: I had a similar issue where my spreadsheet suddenly stopped recognising custom functions that have been working for months. No code changes have been made recently and the spreadsheet hadn't even been edited since it last worked. When I went to Tools > Script editor it still showed the code with the custom functions.

Reloading the page and closing and reopening didn't fix it. I added a simple parameterless wrapper function to call the custom function with some appropriate arguments.

I then ran this wrapper function in the debugger with a breakpoint in the original custom function. When it hit this, I switched back to the spreadsheet and it could magically see the custom functions again.

like image 90
HexAndBugs Avatar answered Sep 28 '22 00:09

HexAndBugs


If you already published as Add-on, then you need to do reactivate the addon for copied sheet with the following steps:

  • Click the menu Add-ons / YOUR-ADD-ON-NAME / Help / View in store,
  • click Manage and in the dropdown menu uncheck then check the 'Use in this document' again for the addon to be loaded to the current sheet.
like image 31
Dryland Avatar answered Sep 28 '22 00:09

Dryland