Search code examples
google-apps-scriptgoogle-sheetscustom-function

Using a Custom Function in a Google Spreadsheet?


I'm trying to figure out how I can write and run a custom function in a Google spreadsheet and I've been following this google tutorial.

However at the time of this posting, I fear that this tutorial is out of date. I followed the steps, but see no way to access my in2mm function from within the spreadsheet that I started at. The tutorial suggests the following to make it show up

You can manually start the scan by going to Tools > Script Manager... and clicking the Reload button.

However, no such menu item exists.

Tools drop down, no "Script Manager"

Just cut off in that screenshot is a "Script Center Menu", which has just one option for "Read Data". It's unclear what that does. It's also unclear how the "Script Editor" ends up tying back into the existing spreadsheet to become available...

Does anyone know the current steps required to write a simple google script function and then access it from within a Google spreadsheet?


Solution

  • I had the same problem, and while the tutorial and Sum Ting Wong's answer actually do work, it didn't help in my case.

    The sheet I was trying to use the custom function from was in the old format. So I converted it to the new format,created a custom function, and now I can use it the sheet.

    Here's how you see if it's an old format sheet Check out the new Google Sheets

    You can tell that a spreadsheet has been created in, or upgraded to, the new Google Sheets if it has a green checkmark at the bottom.

    and here's how to convert it to the new format: Moving spreadsheets to the new Google Sheets

    you can manually move spreadsheet contents into the new version of Sheets to take advantage of new functionality, following any of these steps:

    • Copy and paste content from a spreadsheet created in the old version to a spreadsheet created in the new version.
    • In a spreadsheet created in the old version, click the down arrow next to a sheet tab and click Copy to…, and copy the sheet (and its contents) to a spreadsheet created in the new version.
    • Export the contents from the old version and import them into a spreadsheet created in the new version.