Importing named functions

733 Views Asked by At

Google Sheets has a new feature rolled out earlier called named functions and it is pretty useful. However, you need to manually import it into your sheet. I didn't see anything in the docs on how to do it programmatically. Do anybody know how to do that?

Thought someone might know because there are some functions that are hidden like programmatic enabling a link to another sheet via importrange.


This is what I came up with in hoping someone else with similar problem can benefit.

I had this as a named function =date(left(text,4),mid(text,5,2),right(text,2)) all it did was take a string such as 20221027 and turns it into a date format such as 10/27/2022.

It's easier to not use the named function and just use the new built in map and lambda

map(A1, lambda(text, date(left(text,4),mid(text,5,2),right(text,2))))

then you can replicate that across your sheets with the API.

A1 itself is a formula, without map, lambda, the formula is 3x longer and really difficult to read and edit.

1

There are 1 best solutions below

0
On

From : https://support.google.com/docs/answer/12504534?hl=en

Import named functions As you create more named functions or start to find useful ones that others created, you want to be able to use them in different sheets. To reuse created named functions, you can import them from another sheet into your current one:

On your computer, open Google Sheets. Open the sheet that you want to import the named functions to. At the top, click Data and then Named functions and then Import function. Select the sheet that you want to import from. Select the named functions that you want to import. If you want to import all the named functions from the file, click Import all. Click Import.