custom-function

JSDoc for showing optional arguments in Google Sheets autocomplete dropdown

╄→尐↘猪︶ㄣ 提交于 2019-12-20 02:54:06
问题 I'd like to document (in the Google Sheet autocomplete) a custom function with optional arguments, similar to the WEEKDAY function (autocomplete below). The JSDoc spec on optional arguments does not work. Google does not seem to document this anywhere. How can I create a function with the same visual treatment (both in the argument description and the Example) that Google has? /** * Summary of function * @param {"example"} arg Argument description * @param {"optional"} opt_arg This argument

Throwing custom exceptions and error messages in Google Sheets custom function?

亡梦爱人 提交于 2019-12-19 18:52:55
问题 In Google Sheets (as with Excel, etc) if a user enters bad input into a formula, an error code will be printed in the offending cell and a small pop-up provides more detail about the error. So if I enter '=SQRT(-1)', '#NUM!' is printed in the cell and the pop-up explains that the value needs to be equal to or greater than 0. How can I replicate this with a custom function in Google Sheets? Throwing an exception mostly works. For example, if I catch an out-of-bounds input value and then throw

How to add “custom function help” to a google spreadsheet. - not the script editor

*爱你&永不变心* 提交于 2019-12-19 07:11:35
问题 It is possible to add "custom function help" to a google spreadsheet? i.e. If I type =sum into a spreadsheet cell, I get floating help text, is there a way to do this with custom functions? Documentation in google apps script is created using JSDoc http://en.wikipedia.org/wiki/JSDoc style (JavaDoc like) comments. as documented here https://developers.google.com/apps-script/guide_libraries?hl=en#guidelines it looks like these only work in the script editor. It there a way of adding

How to add “custom function help” to a google spreadsheet. - not the script editor

好久不见. 提交于 2019-12-19 07:11:17
问题 It is possible to add "custom function help" to a google spreadsheet? i.e. If I type =sum into a spreadsheet cell, I get floating help text, is there a way to do this with custom functions? Documentation in google apps script is created using JSDoc http://en.wikipedia.org/wiki/JSDoc style (JavaDoc like) comments. as documented here https://developers.google.com/apps-script/guide_libraries?hl=en#guidelines it looks like these only work in the script editor. It there a way of adding

Custom Functions and Recalculation

浪尽此生 提交于 2019-12-18 08:52:13
问题 I have a custom function that accepts three range names as input parameters. When values of cells in these ranges change, the function output stays the same. This is a "feature" of the platform. Is there any proper way (as of yet) to make custom functions in Google Sheets recalculate dynamically? I know people have tried adding now() as a parameter, which used to continuously recalculate regardless of need. (Now blocked in new sheets.) Has anyone found a satisfactory solution? 回答1: The proper

Custom Functions and Recalculation

拜拜、爱过 提交于 2019-12-18 08:51:03
问题 I have a custom function that accepts three range names as input parameters. When values of cells in these ranges change, the function output stays the same. This is a "feature" of the platform. Is there any proper way (as of yet) to make custom functions in Google Sheets recalculate dynamically? I know people have tried adding now() as a parameter, which used to continuously recalculate regardless of need. (Now blocked in new sheets.) Has anyone found a satisfactory solution? 回答1: The proper

Permissions for custom functions in Spreadsheets

人走茶凉 提交于 2019-12-17 14:57:31
问题 I am using a new feature of SpreadSheet in Google Sheets: "Named and protected ranges". In this range of protected cells, I use arithmetic built-in functions and my own written functions. The trigger to run my functions is on edit spreadsheet. Users with write permissions, sharing the link of the spreadsheet, can't properly run my functions for permissions problem while built-in functions run properly. Own can I grant permissions for my functions to run as Google Sheets built-in functions.

Not allowed to execute sendEmail() from custom function, but OK in script editor

ぐ巨炮叔叔 提交于 2019-12-17 10:04:13
问题 I have been trying to find a way to send single row of data to a specific email address in a "live/running" spreadsheet that I am using within my domain, to keep track of truck drivers and their pick up numbers. I managed to piece together this little bit of code using the Google Apps Script Editor available in sheets: function sendEmail() { var sheet = SpreadsheetApp.getActiveSheet(); var activeRow = sheet.getActiveCell().getRow(); var cellID = "H" + activeRow; var dataRange = sheet.getRange

Passing cell references to spreadsheet functions

点点圈 提交于 2019-12-17 09:48:16
问题 When I call a spreadsheet function, say int(f2) , the function operates on the value in the cell. If cell("F2") contains 3.14159, the result would be 3. But when I call a different type of function — for example: row(f8) — the function takes the cell reference, and not the value, in this case, returning 8. How do I get my custom function to work with the reference, rather than the value? I can pass a string, and use getRange() , but, if I move or update the cells on the sheet, the strings won

No permission to call msgBox in Google Apps Scripting

こ雲淡風輕ζ 提交于 2019-12-17 06:57:09
问题 I'm having trouble running even the simplest Google Apps Scripts, for instance when I run this script by setting a cell my spreadsheet to =pantsHate(Y) I'm getting this error: error: You do not have permission to call msgBox function pantsHate(pref) { var preference = pref; switch (preference) { case "Y": Browser.msgBox("You hate pants."); break; case "N": Browser.msgBox("You do not hate pants."); break; default: Browser.msgBox("You hate answering Y or N"); break; } return pref; } My end goal