KOKOCAL SCRIPT

Guide

Using Multiple Scripts Together

This guide explains what to check when adding multiple Apps Scripts generated by KOKOCAL SCRIPT to the same Google Sheets or Google Slides project. Organize file names, function names, menus, and triggers to prevent unintended overwrites or duplicate execution.

Published: 2026.08.03Updated: 2026.08.03

Protect existing code

Back up existing code before pasting so you can add scripts without breaking current behavior.

Avoid duplication

Check duplicate function names, menu names, and triggers before operation.

Verify step by step

Do not install several scripts at once. Add one, test it, then continue to the next script.

Basic policy

It is possible to use multiple scripts in the same Apps Script project. However, if the same function name or trigger exists more than once, one process may overwrite another or the same process may run multiple times.

For safer operation, add one script at a time, save, authorize, reload, and test it. Add the next script only after confirming that the previous one works correctly.

When unsure, do not add scripts directly to an important business file. Test setup in a copied file first.

Common menu entry example

function onOpen(e) {
  KOKOCAL_buildMenu(e);
}

function KOKOCAL_buildMenu(e) {
  const ui = SpreadsheetApp.getUi();
  const menu = ui.createMenu('KOKOCAL');

  if (typeof KOKOCAL_IncrementalSync_registerMenu === 'function') {
    KOKOCAL_IncrementalSync_registerMenu(menu);
  }

  if (typeof KOKOCAL_DuplicateFinder_registerMenu === 'function') {
    KOKOCAL_DuplicateFinder_registerMenu(menu);
  }

  menu.addToUi();
}

Generated code now uses KOKOCAL_Menu.gs for this role. Each feature file exposes KOKOCAL_<ToolName>_registerMenu(menu), and that function adds only its own items to the shared KOKOCAL menu.

Steps for adding multiple scripts

  1. 1

    Back up existing code before adding

    Copy existing .gs and HTML files so you can restore them before starting. For business files, also back up the file itself when possible.

  2. 2

    Organize the project name and file names

    When adding multiple scripts, manage the Apps Script project name, KOKOCAL_Menu.gs, KOKOCAL_<ToolName>.gs, and HTML files with clear names.

  3. 3

    Check duplicate function names

    If a function with the same name already exists in the project, later pasted code can overwrite behavior or run an unintended process.

  4. 4

    Keep one KOKOCAL_Menu.gs file

    The top-menu entry point is centralized in KOKOCAL_Menu.gs. Do not keep multiple different KOKOCAL_Menu.gs files; use one current version.

  5. 5

    Check menu names and menu items

    Multiple features are grouped under the top-level KOKOCAL menu. Confirm that each installed feature appears as an item there.

  6. 6

    Do not register duplicate triggers

    Running setup functions repeatedly can duplicate time-driven or installable triggers. Check the trigger list and remove unnecessary duplicates.

Checklist before and after adding

File names

Confirm that KOKOCAL_Menu.gs, KOKOCAL_<ToolName>.gs, HTML files, and helper files match the setup instructions.

Function names

Check that setup, run, registerMenu, and other functions do not duplicate existing code. Functions beginning with KOKOCAL_ are scoped for multi-script use.

Menus

Confirm that the top-level KOKOCAL menu appears in Google Sheets or Google Slides and includes the intended feature items.

Triggers

Open the Apps Script trigger screen and confirm that the same process is not registered more than once.

Permissions

Adding multiple scripts may expand the authorization scope. Review the authorization screen before allowing access.

Behavior checks

Before using production data, test each menu separately with a copied file or a small data set.

Cautions

Centralize onOpen in KOKOCAL_Menu.gs

When using multiple scripts, keep onOpen only in KOKOCAL_Menu.gs. Each feature registers itself through KOKOCAL_<ToolName>_registerMenu(menu).

Installable triggers use specific function names

For form submit or edit detection in incremental sync, KOKOCAL_IncrementalSync_setup registers triggers using specific function names beginning with KOKOCAL_. Do not add duplicate triggers manually.

Check HTML file names including capitalization

Apps Script HTML file names must match the name specified in createHtmlOutputFromFile in the code.

Review authorization before allowing access

Adding scripts may request access to spreadsheets, slides, triggers, and other services. Check the details before approving.