I don’t understand what I did wrong here
Syntax error: SyntaxError: Unexpected token ‘.’ line: 8 file: Code.gs
I was working on google docs script editor
I tried removing and adding the dot back but didn’t work so the script is below
function onOpen() {
var ui = DocumentApp.getUi();
ui.alert(
'Hello!',
'Welcome to JNT_Network. This is a place for people to be free, if you are against us finding unblockers, we respectfully ask that you leave this doc and never come back. Thanks!',
ui.ButtonSet.OK
);
.addSubMenu(ui.createMenu('Credits')
.addItem('Joseph(Owner)', 'joseph2'))
.addToUi();
}
function joseph2() {
DocumentApp.getUi() // Or DocumentApp, SlidesApp or FormApp.
return HtmlService.createHtmlOutputFromFile('j');
}
the j in the html service is j.html
>Solution :
You have to create the menu first, then call addSubMenu() on that.
function onOpen() {
var ui = DocumentApp.getUi();
ui.alert(
'Hello!',
'Welcome to JNT_Network. This is a place for people to be free, if you are against us finding unblockers, we respectfully ask that you leave this doc and never come back. Thanks!',
ui.ButtonSet.OK
);
ui.createMenu('Main Menu').addSubMenu(ui.createMenu('Credits')
.addItem('Joseph(Owner)', 'joseph2'))
.addToUi();
}
function joseph2() {
DocumentApp.getUi() // Or DocumentApp, SlidesApp or FormApp.
return HtmlService.createHtmlOutputFromFile('j');
}
See the example in the documentation