J. G.
J. G.

Reputation: 1832

Can't create a menu without changing the runtime version?

This code will not work for onopen or executed from the code editor.

function onOpen() {
    var ui = SpreadsheetApp.getUi();
    ui.createMenu('X Function')
        .addItem('Create X from X', 'rawDataReform')
        .addItem('Generate XX', 'printXXX')
        .addItem('Clear all results', 'clearTabs')        
        .addItem('Link the Tabs','importNewData')
        .addToUi();
}

The error I am getting says

"this action is not supported unless the runtimeVersion is set to "DEPRECATED_ES5"

in the appscript.json file.

This particular code was not handled in clasp so

1) I don't know how to get to the json file and

2) how do I figure out what absolutely basic function has been randomly deprecated here.

Upvotes: 0

Views: 574

Answers (2)

TheMaster
TheMaster

Reputation: 50697

Currently, all functions seem to give that error, if you're in V8. You might want to try later. To change your runtime back, Go to View> Show manifest file. In appsscript.json, set

"runtimeVersion": "DEPRECATED_ES5"

and save it.

Upvotes: 4

Cooper
Cooper

Reputation: 64100

This works for me:

function onOpen() {
  SpreadsheetApp.getUi().createMenu('X Function')
  .addItem('Create X from X', 'rawDataReform')
  .addItem('Generate XX', 'printXXX')
  .addItem('Clear all results', 'clearTabs')        
  .addItem('Link the Tabs','importNewData')
  .addToUi();
}

I think the appscript.json file is displayed when you display manifest in View Menu

Upvotes: 1

Related Questions