Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8676083
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T20:06:01+00:00 2026-06-12T20:06:01+00:00

I will distribute a spreadsheet with onOpen menu among several users. I would like

  • 0

I will distribute a spreadsheet with onOpen menu among several users. I would like to keep the menu definitions and functionality within a Library, so if I add some menu options or update some functions, everyone using that spreadsheet will get updated automatically.

So far, on the spreadsheet script I have only this simple code:

function onOpen() {
  myLib.loadMenu();
}

The menu loads on the spreadsheet without a problem, however no matter how I named the call on the menu and the actual function (with or without myLib.) I always get an error “Script function doSomething could not be found” when using an option from that menu.

Any idea on how should I name the function call in the menu and the actual function in the library, for this approach to work.

Thanks, Fausto

EDIT-1: Let me give more details and sample code

My goal is being able to add more options to that spreadsheet menu from the library, without having to update every user’s spreadsheet.

This is sample code all included in the spreadsheet script, no library been used yet and it works without problem

function onOpen() {
  testMenu();
}
function testMenu() {
  SpreadsheetApp.getActiveSpreadsheet().addMenu(
    'Testing', [
      { name: 'Do Something #1', functionName: 'someFunction1' },
      null,
      { name: 'Do Something #2', functionName: 'someFunction2' } ]);
}
function someFunction1() {
  SpreadsheetApp.getActiveSheet().getRange("A1").setValue("Hello from someFunction1");
}
function someFunction2() {
  SpreadsheetApp.getActiveSheet().getRange("A2").setValue("Bye from someFunction2");
}

What I want to do is get the same functionality, but splitting the code between the spreadsheet script and a library, as follow

On the spreadsheet script

function onOpen() {
  xsLib.testMenu();
}

On the library

function testMenu() {
  SpreadsheetApp.getActiveSpreadsheet().addMenu(
    'Testing', [
      { name: 'Do Something #1', functionName: 'someFunction1' },
      null,
      { name: 'Do Something #2', functionName: 'someFunction2' } ]);
}
function someFunction1() {
  SpreadsheetApp.getActiveSheet().getRange("A1").setValue("Hello from someFunction1");
}
function someFunction2() {
  SpreadsheetApp.getActiveSheet().getRange("A2").setValue("Bye from someFunction2");
}

On this splitting approach the menu built from the library call shows correctly on the spreadsheet, however when using an option from that Testing menu, I get a message error like: “Script function someFunction1 could not be found”

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T20:06:02+00:00Added an answer on June 12, 2026 at 8:06 pm

    Last I checked you cannot give to a trigger functions that are not contained within the script. What you most likely need to do is to create a wrapper function in the script for your scpreadsheet. Something like this:

    function doSomething() {
      myLib.doSomething();
    }
    

    EDIT:
    The functionality that you are looking for is currently unavailable. To achieve the desired effect you would need to specify that the function that you want to call belongs to the library and that is not allowed.

    There is a feature request for this:

    http://code.google.com/p/google-apps-script-issues/issues/detail?id=799

    If you are interested in having this functionality, please go and vote on this issue to increase its priority.

    Best,

    Anton

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

We would like to distribute our app internally within the company for dogfood testing,
A client wants to add functionality to a system that will distribute large files(~700mb)
I am planning on writing a rails application which will distribute tasks to several
I would like to distribute a program I'm halfway done writing but I'm having
Will Java 8 support pattern matching like Scala and other functional programs do? I'm
I'm developing a game that I will distribute using Java Web Start / JNLP.
I'm looking for a formula or rule that will allow me to distribute n
I'm nearly ready to distribute my vb.net application. I have several picturebox files which
I'd like to distribute my program as a binary, not in source code form.
Basically a web app that we distribute to clients, one of whom will be

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.