'Sheet Add On Menu is not showing after publish it in google workspace marketplace

I create a sheet add on. Its simple:

  1. Create a menu with one option that allow users create other menu in their current worksheet. Menu options are created with data of the same sheet.
  2. Each menú navigate to a fix url with three URL Parameters

My complete code is:

function onInstall (e) {
  onOpen(e)
}

function onOpen (e) {
  try {
    SpreadsheetApp.getUi().createAddonMenu()
    .addItem('Crear Menú', 'createMenu')
    .addSeparator()
    .addItem('Test', 'exportInit')
    .addToUi();
  } catch (error) {
    SpreadsheetApp.getUi().alert('Oh there is an error: ' + error);
  }       
  createMenu();
}

var menuItemArray = SpreadsheetApp.getActiveSpreadsheet().getSheetByName('MiMenu').getDataRange().      getValues();  
for (menuCount=0;menuCount < menuItemArray.length;menuCount++) {
  let id = menuCount;
  let funName = "dynamicFun" + id;
  this[funName] = function() { menuClick(menuItemArray[id][1]); };
}   

function createMenu() {
  try {
    var ui = SpreadsheetApp.getUi(); 
    var menuCount = 0; 
    var menu = ui.createMenu('Joka Reports');
    var menuItemArray = SpreadsheetApp.getActiveSpreadsheet().getSheetByName('MiMenu').getDataRange().      getValues();  
    for (menuCount=1;menuCount <= menuItemArray.length-1;menuCount++) {
      try {
        let id = menuCount;
        let funName = "dynamicFun" + id;
        menu.addItem(menuItemArray[menuCount][0], funName)
      } catch (error) {
        SpreadsheetApp.getUi().alert('Oh there is an error: ' + error);
      }      
      menu.addToUi();
    }   
  } catch (error) {
    SpreadsheetApp.getUi().alert('Oh there is an error: ' + error);
  }     
}

function menuClick(reportName) {
  try {
      var currentCulture = SpreadsheetApp.getActiveSpreadsheet().getSpreadsheetLocale();
      var myuserToken = ScriptApp.getIdentityToken();

      openUrl('https://SomeURL?reportname=' + reportName + '&usertoken=' + myuserToken + '&currentCulture=' +       currentCulture);
  } catch (error) {
    SpreadsheetApp.getUi().alert('Oh there is an error: ' + error);
  }     
}

function openUrl( url ){
  var html = HtmlService.createHtmlOutput('<html><script>'
  +'window.close = function(){window.setTimeout(function(){google.script.host.close()},9)};'
  +'var a = document.createElement("a"); a.href="'+url+'"; a.target="_blank";'
  +'if(document.createEvent){'
  +'  var event=document.createEvent("MouseEvents");'
  +'  if(navigator.userAgent.toLowerCase().indexOf("firefox")>-1){window.document.body.append(a)}'                          
  +'  event.initEvent("click",true,true); a.dispatchEvent(event);'
  +'}else{ a.click() }'
  +'close();'
  +'</script>'
  // Offer URL as clickable link in case above code fails.
  +'<body style="word-break:break-word;font-family:sans-serif;">Failed to open automatically. <a href="'+url+'" target="_blank" onclick="window.close()">Click here to proceed</a>.</body>'
  +'<script>google.script.host.setHeight(40);google.script.host.setWidth(410)</script>'
  +'</html>')
  .setWidth( 90 ).setHeight( 1 );
  SpreadsheetApp.getUi().showModalDialog( html, "Cargando ..." );
}

My appscript.json:

{
  "addOns": {
    "sheets": {
      "homepageTrigger": {
        "runFunction": "onOpen"
      }
    }
  },
  "timeZone": "America",
  "dependencies": {},
  "oauthScopes": [
    "https://www.googleapis.com/auth/spreadsheets.currentonly",
    "https://www.googleapis.com/auth/userinfo.email",
    "https://www.googleapis.com/auth/script.container.ui"
  ],
  "exceptionLogging": "STACKDRIVER",
  "runtimeVersion": "V8"
}

The add on runs fine when i install it from test build, but when i publish it in Google Workspace Market Place API from My Project, Google Answer me:

The App doesn’t meet the publishing review criteria on the following: Functionality - There are no obvious bugs and all visible actions are fully functional. You must ensure the Add-on is operational and functions in accordance with the description of the Add-on. You should thoroughly test all the add-ons you create before publishing using the available test options.

Additional notes: Retesting the App it is still not possible to create the menu since the only option is stiall "help". We will be pending to approve the app once these changes are made. Evidence attached in the following link: https://photos.app.goo.gl/FGQ4QTm1D3ga7bYF7

In my Google Console i have OAuth Consent Screen Approve with three scopes that i need. My Project Number is setting in my sheet app script project, i had set correctly script id and version number in google marketplace api.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source