Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Google Sheets not showing custom function in autocomplete

I can't get the google sheets autocomplete to show my custom function even when I use Google's version (see below). I have the jsdoc info correctly formatted, but it still doesn't show up. I'm sure I'm just overlooking something stupid, but I can't find it. So what am I missing?

Google's demo code:

/**
 * Multiplies the input value by 2.
 *
 * @param {number} input The value to multiply.
 * @customfunction
 */
function double(input) {
  return input * 2;
}

BTW, I'm using Chrome to develop my custom functions. Also, my function works, just no autocomplete. All the built-in functions autocomplete works.

Thanks in advance for the help!

Brad

like image 795
Brad Avatar asked Dec 20 '22 15:12

Brad


1 Answers

I managed to get the custom function autocomplete working yesterday. It seems to only work with container-bound scripts, so any JSDoc info inside a script being used as a library will not come across. To verify it works, I did the following:

  • Create new Google Sheet
  • Open Script Editor
  • Enter the following in the script:

    /**
     * Returns amount multiplied by itself.
     *
     * @param {Number} amount The amount to be multiplied by itself.
     * @return {Number} The amount multiplied by itself.
     * @customfunction
     */
    function test(amount) {
      return amount*amount;
    }
    
  • Then, when entering =test into a cell in the spreadsheet, the information above the function appears in the autocomplete hint, like any other built-in spreadsheet function.
like image 80
mwjeffcott Avatar answered Dec 27 '22 07:12

mwjeffcott