G
G
Graun2020-02-07 04:06:42
Google Apps Script
Graun, 2020-02-07 04:06:42

How to assign functions from other scripts to buttons in a script?

Hello, tell me how to assign functions from other scripts to the buttons in the script, so that in the attached script for the menu, do not prescribe the entire script for each button, so that it refers to another script. After all, I can have more than 10 buttons, and stuffing all the scripts into one is too big.

// Функция onOpen() запускается всегда при открытии документа
// https://developers.google.com/apps-script/guides/triggers/#onopen
function onOpen()
{
    // Создаём новое меню
    // https://developers.google.com/apps-script/reference/base/ui#createmenucaption
    SpreadsheetApp.getUi()
        .createMenu('Меню Запуска')
        .addSubMenu(SpreadsheetApp.getUi().createMenu('Отправить')
            .addItem('Отправить', 'otpravit')
            .addItem('Договора', 'DOGOVORA'))
           .addToUi();
  }

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexander Ivanov, 2020-02-07
@oshliaer

No way.
You must either copy and maintain copies of the code, or use external linkers.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question