Questions tagged [custom-function]

DO NOT USE THIS TAG ALONE. Unlike built in functions where the functions are designed by the product designers for mass use, Custom functions are functions that are custom designed for only a subset of end users. Use for questions relating to such functions along with the product in question(eg [sql], [google-sheets],[excel]).

545 questions
3
votes
1 answer

Define a LibreOffice Calc custom function in Python

I am writing custom functions in LibreOffice Calc. Such functions must be called in Calc as if they were native functions, e.g. as EDATE(), DAYS() etc. Upto now what I am doing for each custom function is: Define a Python function Define a…
Nicola Mingotti
  • 860
  • 6
  • 15
3
votes
1 answer

XGBoost python custom objective function

According to documentation, http://xgboost.readthedocs.io/en/latest/python/python_api.html if we want to define custom objective function, it should have signature objective(y_true, y_pred) -> grad, hess where hess: array_like of shape…
3
votes
2 answers

Range input to function in Google apps script

In a cell in my google sheet, I call my function like this: myFunction(A1:A3), where A1 = 5, A2 = 7 and A3 = 3. I now want to loop over the input (A1, A2, and A3) and (for example) sum them. function myFunction(input) { if (!input.map) { …
lijas
  • 466
  • 1
  • 6
  • 17
3
votes
3 answers

Google spreadsheet: Value parameter can not be parsed

I'm using this script to integrate ImportJSON inside my google sheet. The command I'm performing is: =IF(B4="";"";VALUE(ImportJSON("https://min-api.cryptocompare.com/data/price?fsym="&B4&"&tsyms=USD";"/USD";"noHeaders";$L$1))*$C$2) Where B4…
3
votes
1 answer

geom_hline or geom_vline does not seem to accept vector for reference line, if called inside a function and facet_grid() is used

I have been facing issue with geom_hline or geom_vline if I call it under custom function and it takes the value from a vector. It seems to work fine until I add facet_grid() within that function body.e.g Without Function c<- data.frame(A =…
Sana Ali
  • 165
  • 1
  • 11
3
votes
3 answers

Recursively access potentially nested value based on one or more provided keys

I'm trying to access a nested array (an array which contains arrays which contains arrays …) I need to get the last value, given the array and the path of keys. Given foo and a…z i need to get foo[a][b][c]…[x][y][z] I'm wondering if there is any…
Verim
  • 1,065
  • 9
  • 17
3
votes
0 answers

How to return an image from a Custom Function in Google Sheets?

I'm trying to create a custom function that returns an image to the cell that calls it. Here's a simplified version of my script. function ProfilePic() { var profilepicurl = 'http://example.com/image.jpg' var ss =…
3
votes
3 answers

Google Script - DriveApp.getFilesByName - Error (No Permission)

I'm trying to call custom function pdfFile from Google Spreadsheets. function pdfFile(number, revision) { // Log the name of every file in the user's Drive. Logger.log(number + '_R' + revision + '.pdf'); var files =…
3
votes
1 answer

How to write a custom function that outputs an image to a Google spreadsheet?

I'm working on a Google Drive spreadsheet. Is it possible to create a custom function / script to display an image? The idea would be that when I typed the function (= tick) a tick mark image would be displayed in the cell.
grabury
  • 4,797
  • 14
  • 67
  • 125
3
votes
1 answer

Quickly looping through multiple sheets to find data

Hi i'm trying to write a custom function that takes a pair of cells, loops through all the worksheets in the spreadsheet to find an identical matching pair of cells, and returns another value from that same row. Background; sheet 0 is a master…
3
votes
2 answers

Google Apps Tutorial: Your First Custom Function

I am fairly new to google apps script and I came across this issue while trying out tutorial on "Your First Custom Function". =in2mm(1) -> 25.4 =in2mm(2) -> 50.8 =in2mm() -> #ERROR (error: input must be a number (line 6)) =in2mm(pi()) ->…
Mozart_1
  • 33
  • 1
  • 4
2
votes
2 answers

Optionally passing a struct to a custom function in C#

There are other similar SO posts on this, but I'm struggling to find anything that makes much sense. Still fairly new to C# here... So, all I want to do is add an optional parameter to a custom function. This param needs to contain two values so I…
Ric
  • 458
  • 1
  • 7
  • 23
2
votes
1 answer

Problem changing the color of a cell partially with Apps Script

I need to put 2 rows of data in a single cell, and color code them like so: [endgoal] So I decided to make a custom function with apps script, so far i've only been able to make the text be on top of each other, but can't for the life of me make it…
2
votes
1 answer

You do not have permission to call DriveApp.getFileById

I have a Spreadsheet and Apps Script in the background that is serving a function CONFIRM(cell). This function performs several actions in the background Code that is causing trouble: function convertPDF(docId){ const targetDir = "Redacted"; var…
2
votes
1 answer

Is it possible call a custom function on another sheet of Spreadsheet on Google Sheets?

I want to call a custom function of a spreadsheet A on a sheet of spreadsheet B, wihtout the need to rewrite the other function that encapsulates the original custom function defined in spreadsheet A. Is it possible for free? For example. //…
rplaurindo
  • 1,277
  • 14
  • 23