I have set up multiple custom menus in one of my Google Sheets. While the items in the menu stay in order, the 3 menus that I have created are always switching places. Is there a way for me to order them in the script to stop them changing order.

I have used and onOpen function (see below) for each of them

function onOpen() {
  var ui = SpreadsheetApp.getUi();
  // Or DocumentApp or FormApp.

I am using multiple projects. All 3 menus show up and work on the workbook, but they keep changing order.

  • Welcome. A Google Apps Script project can only use one onOpen simple trigger. Are you using installable triggers or multiple projects? Oct 26, 2019 at 13:05
  • hi ruben, i am using multiple projects. all 3 menus show up and work on the workbook, but they keep changing order Oct 26, 2019 at 13:37
  • Please add those details to the question. Oct 26, 2019 at 13:41
  • fixed for you ruben Oct 26, 2019 at 13:59

1 Answer 1


There is no way to set the order in which the projects will be loaded. If you want to keep the menus in the same order all the time, they should be handled from the same project and from one on open function.

NOTE: I didn't tried this yet but I'm pretty sure that it should work


function onOpen(e){
  var menu1 = SpreadsheetApp.getUi().createMenu('Menu 1');
  var menu2 = SpreadsheetApp.getUi().createMenu('Menu 2');
  var menu3 = SpreadsheetApp.getUi().createMenu('Menu 3');

  // Populate each menu here

   * Add the menus to the UI in the order that you want them

The reason is that the project load order is not deterministic, it depends on several factors including but not limited to Google data centers load and the fact that each on open function has it's own execution instance, they are ran asynchronously , some time one could be the faster but other times the slower.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.