Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Syntax error: SyntaxError: Unexpected token '.' line: 8 file: Code.gs

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

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>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

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading