简体   繁体   中英

Autocomplete for custom functions added via a script in Google Sheets

I have added the very basic example script "Double" via the instructions given in the Google Apps Scripts guide. Simple stuff, but the function does not show up in my Google Sheet when I type in a cell "=doub..."

I get no errors in the script editor. I can run the default functions within Google Sheets, yet I can't get any new functions to appear.

The assumption is that you are trying to create a custom function and have it show up as an autocomplete item when you are typing formulas in cells.

Custom functions will appear in this list if their script includes a JsDoc @customfunction tag, as in the DOUBLE() example below.

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

usually the commented portion of JavaScript is not too important but in this case it is. The comment must be properly structured to get the function to render as an autocomplete item when typing formulas in cells

https://developers.google.com/apps-script/guides/sheets/functions#autocomplete

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM