Search code examples
google-apps-scriptgoogle-sheetsshared-librariesadd-ongoogle-apps-marketplace

I cannot publish Editor addon on google workspace marketplace -Menu options not shown after App is installed


I have applied to publish an editor add-on on the Google workspace marketplace.

I have applied to publish an editor add-on on the Google workspace marketplace, but it has been rejected for the following reasons

Menu - Menu options not shown after App is installed. Please ensure that the add-on correctly uses onInstall() and onOpen() to populate its menu. The menu items populate when the add-on is first installed and when a different file is opened. See Editor add-on authorization.

In the test of the editor add-on in my environment, the menu is displayed without any problem.

Here is the code. *The contents of unrelated functions are omitted.

function GlobalVar(userLocale){
  if(userLocale === null) userLocale = 'ja';
  return {
    TITLE: (userLocale == 'ja') ? 'こぴぺ' : 'Copipe', //アドオンのタイトル
    VERSION: '1.1.2', //アプリのバージョン
  }
}


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


 function onOpen(e){
  var menu = SpreadsheetApp.getUi().createAddonMenu();
  var userLocale = Session.getActiveUserLocale(); //ユーザーが使用している言語判定
  if(userLocale != 'ja') userLocale = 'en'; //日本語以外の場合は英語表記にする

  var itemInfo = {
    Item1 : {func:'display_sidebar', ja: '操作パネル表示', en: 'Show Sidebar'},
    Item2 : {func:'dispVersion', ja: 'バージョン情報',en: 'about version'}
  };
  menu.addItem(itemInfo.Item1[userLocale],itemInfo.Item1.func)
    .addSeparator()
    .addItem(itemInfo.Item2[userLocale],itemInfo.Item2.func);  

  menu.addToUi(); //メニューを追加
}



function askEnabled(){
  let userLocale = Session.getActiveUserLocale();
  let title = GlobalVar(userLocale).TITLE;
  let msg = userLocale === 'ja' ? "スクリプトが有効になりました\nもう一度メニュー画面を開いてサイドバーを表示させてください" : "The script has been enabled.\nOpen the menu screen again to display the sidebar.";
  let ui = SpreadsheetApp.getUi();
  ui.alert(title, msg, ui.ButtonSet.OK);
  onOpen();
};


function display_sidebar(){
  let userLocale = Session.getActiveUserLocale(); //ユーザーが使用している言語判定

  let SidebarHTML = HtmlService.createTemplateFromFile('sidebar');
  SidebarHTML.LANGUAGE = userLocale; //サイドバーに言語情報を送る
  let Sidebar = SidebarHTML.evaluate().setTitle(GlobalVar(userLocale).TITLE);
  SpreadsheetApp.getUi().showSidebar(Sidebar); //サイドバーを表示 
}


function dispVersion(){
  let userLocale = Session.getActiveUserLocale(); //ユーザーが使用している言語判定

  Browser.msgBox(GlobalVar(userLocale).TITLE + " Version",'Version:  ' +GlobalVar(userLocale).VERSION, Browser.Buttons.OK);
}


function toolTask(TASK_ORDER){
  return toolTaskRun().start(TASK_ORDER);
}

function toolTaskRun() {
  return {
    SPRED: null,
    SHEET: null,
    JOB: null,
    INFO: null,
    TAG_NAME: '_copipe_',
    
    init: function(){
      this.SPRED = SpreadsheetApp.getActiveSpreadsheet();
      this.SHEET = this.SPRED.getActiveSheet();
    },
    start: function(TASK_ORDER){
     
    },
    copy: function(){
      
    },
    paste: function(TAISHO){
      
    },
    moveRows: function(){
      
    },
    moveColumns: function(){
      
    },
    
    zettai: function(MODE){
      
    }
  };
}

Apart from this, I load my own libraries.

The manifesto is below.

{
  "timeZone": "Asia/Tokyo",
  "exceptionLogging": "STACKDRIVER",
  "runtimeVersion": "V8",
  "dependencies": {
    "libraries": [
      {
        "userSymbol": "SetNamedRange",
        "version": "0",
        "libraryId": "1M0tYhnFHYkxl0IXsDju8NWTvWHZWBY8H4-Z7eFOIKyi26p-Ymmtu7C7r",
        "developmentMode": true
      }
    ]
  },
  "oauthScopes": [
    "https://www.googleapis.com/auth/spreadsheets",
    "https://www.googleapis.com/auth/script.container.ui",
    "https://www.googleapis.com/auth/userinfo.email"
  ]
}

I have no idea what to change. Can someone please tell me what to do?


Solution

    1. Change the development mode of your library to false
      1. Assure that the Apps Script project holding your library has been deployed
      2. Assure that the Apps Script project holding the add-on code is set to use version of you library
    2. Assure that the library is shared with anyone having the link