Custom function not appearing in Google Sheets autocomplete suggestions

I’m having trouble with my custom function in Google Sheets. It works fine but doesn’t show up in the autocomplete suggestions. I’ve followed Google’s example and used the correct jsdoc format:

/**
 * Doubles the given number.
 *
 * @param {number} value The number to double.
 * @customfunction
 */
function multiplyByTwo(value) {
  return value * 2;
}

I’m using Chrome for development. The built-in functions appear in autocomplete, but mine doesn’t. Am I missing something obvious? Any ideas on how to fix this?

hey, had similar probs. make sure ur script is actually linked to the sheet (sometimes it disconnects). also, try renaming the function - google can be picky. if nothin works, give it time. autocomplete can be slow to catch up. good luck!

I’ve encountered this issue before, and it can be frustrating. One thing to check is if you’ve saved the script after making changes. Sometimes, the autocomplete doesn’t update immediately. Try closing and reopening the spreadsheet, or even clearing your browser cache. If that doesn’t work, ensure you’re using the latest version of Chrome, as older versions might have autocomplete issues. Also, double-check that your function is in the correct script file associated with the spreadsheet. If all else fails, you might need to wait a bit - Google’s systems can take time to update and recognize new custom functions. In the meantime, you can still use the function by typing it manually.

I’ve dealt with this exact issue in my projects. One thing that’s often overlooked is the permissions setting for your script. Make sure it’s set to ‘Execute as you’ and that you’ve authorized it properly. Sometimes, Google’s security measures can interfere with custom functions appearing in autocomplete.

Another trick I’ve found helpful is to add a simple custom menu item that calls your function. This seems to ‘wake up’ the autocomplete system. Just add a function like:

function onOpen() {
SpreadsheetApp.getUi().createMenu(‘Custom Functions’)
.addItem(‘Multiply by Two’, ‘multiplyByTwo’)
.addToUi();
}

This creates a menu item and often kickstarts the autocomplete feature. If all else fails, consider breaking your script into smaller functions. I’ve noticed larger scripts sometimes have trouble with autocomplete. Hope this helps!