Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible to define a new function in Google-docs spreadsheet?

Is it possible to define a function in Google Spreadsheets that can be used in any cell?

It would be helpful if I could define and use functions that refer to other cells in the same way that I can use native functions, e.g. by entering =myfunction(C1, C2, C3)

like image 863
David LeBauer Avatar asked Jan 28 '11 21:01

David LeBauer


People also ask

Can you create custom function in Google Sheets?

You can use Google Apps Script to write a custom function, then use it in Google Sheets just like a built-in function. The below quickstart sample creates a custom function that calculates the sale price of discounted items.

Are there functions in Google Docs?

Similar to MS Office, Google docs allows you to create doc, ppt and xls with similar functions such as inserting images and tables, changing ppt background themes and adding formulas in spreadsheets with super subscript and subscript for Mathematical documents.

How do you update a function in Google Sheets?

In Sheets, navigate to Data > Named functions > Add new function > enter details > Next > Create. You can then enter your custom formula into a Sheets' cell. Named functions created in a Sheets file are available only in that file.


1 Answers

Yes - there's a tutorial. Just use javascript functions by name in your spreadsheet. Define them using Tools > Script editor.

Watch out for name restrictions; I was confused by the behavior of functions that I created with names like "function x10() {}" not being found. Renaming to a longer name fixed it. There are probably documented rules for what isn't allowed, but I don't know where they are.

like image 129
James Moore Avatar answered Oct 07 '22 00:10

James Moore