Questions tagged [google-sheets-custom-function]

Use for questions about Google Sheets custom functions (created using Google Apps Script)

Custom function for Google Sheets, written in JavaScript.

Could be used together with

Useful resources

59 questions
49
votes
2 answers

Debugging a custom function in Google Apps Script

I am trying to create my first custom function for a Google Spreadsheet in Apps Script and I am having a hard time using the debugger. I am working on the custom function demo code from the Google documentation and I have set a breakpoint in the…
43
votes
15 answers

New Google Sheets custom functions sometimes display "Loading..." indefinitely

SPECIFIC FOR: "NEW" google sheets only. This is a known issue as highlighted by google in the new sheets. Issues: If you write complex* custom functions in google-apps-script for google sheets, you will occasionally run into cells which display a…
42
votes
6 answers

How to generate an uuid in google sheet?

How to generate an uuid in google sheet (for exemple ccb8a660-91c9-a556-58e0-4fa7-229516872004). Either with a macro? or a formula?
39
votes
5 answers

You do not have permission to call openById

Problem: When I run the script, Google tells me, You do not have permission to call openById I had copied a script from another one of my Google spreadsheets and changed the target_ssKey variable's cell reference and created properly-sized Named…
14
votes
1 answer

Custom Functions with add-ons?

I've been trying to create a Google Spreadsheet plugin from some existing Google App Scripts that I have, and one important part of this app script is Custom Functions. Though the documentation for the add-ons doesn't indicate that this is…
10
votes
2 answers

Conditional formatting in Google Sheets: Can I use custom function in the 'custom formula is:' field?

While applying conditional formatting in Google spreadsheet, I was wondering if it's possible to use a custom function that I created via script editor in the field 'custom formula is:'. Here is what I did: Went to 'script editor' and typed my fn…
7
votes
7 answers

How to determine when all Loading Data operations are finished?

I have a Sheets spreadsheet that has many cells that use a custom function which calls IMPORTHTML and parses the results. Other calculations in the sheet use the returned values from these custom formula cells. As expected, when the custom formula…
4
votes
2 answers

How to change format of cell that runs function

If I have the following user defined function I can return the text "foo"... function myFunction(input){ return "You wrote: "+ input; } How can I assign a red background to the cell through code? Even though it's a simple example, my script is…
3
votes
1 answer

You do not have permission to call setDataValidation

I am trying to use a custom function. Whenever I try to use it as a formula from within sheets and run it on a cell it throws the error: You do not have permission to call setDataValidation But when I run it from the script editor it runs…
3
votes
1 answer

Google apps script error: "You do not have permission to call protect"

I'm trying out my first Google Sheets Apps Script. I'm trying to make a custom function (via a bound script) that will check if the cell it's in is protected. If it is protected, it should change the cell's value to (for now at least) the protection…
2
votes
1 answer

Why isn't array Intersection in google spreadsheet working as expected?

This is my first time using google spreadsheets, and I'm trying to accomplish something in the functions. I know it's javascript (A language I'm not entirely familiar with). I'm trying to take a range from two tables, and get the intersection…
2
votes
2 answers

How to add a table of contents to a Google Sheets spreadsheet?

I'm trying to add a table of contents to Google Sheets: simply want to include a list of all sheets inside the document, as clickable links (got 150+ sheets.) I got it to work, but it's more complicated than I'd like, and leaves me with questions…
2
votes
2 answers

How to return #N/A from Google Sheet App Script?

This seems like a trivial question. But I have spent some times, I still cannot find any clues from the Internet. I have been trying the work-arounds. They all are not nice. Returning null or undefined will just result in a blank cell. Of course…
2
votes
2 answers

Can I make custom function on google spreadsheet without Google Apps Script?

I'm using google spreadsheet with Google Apps Script. but it gives me error message too easily. like this Error Script invoked too many times per second for this Google user account. (line 0). Is there any way to avoid the error? (except the way…
2
votes
1 answer

Iterating over cells in Google Spreadsheet Custom Function

I am trying to build a custom function in Google Spreadsheet, that would basically do this: - say custom function called func() is placed in cell D2 and invoked as =func(B2) - provided a particular cell reference (say B2) as a starting point it…
1
2 3 4