Home > Software design >  Syntax Error : Google Spread Sheet script
Syntax Error : Google Spread Sheet script

Time:04-26

I tried to create a function for google spread sheet. However Appscipt editor doesn't compile my function and throws error, "Error Message: TypeError: SpreadsheetApp.getUi(...).createMenu(...).addItem(...).addItem(...).addSeperator is not a function"

CodePudding user response:

I think is just a typo addSeperator to addSeparator:

Code.gs
const addToUI = () => {
  SpreadsheetApp.getUi().
  createMenu('New Menu')
  .addItem('test1', 'test')
  .addItem('test2','test')
  .addSeparator().addToUi()
}

const test = () => console.log("ECO")

You can follow this guide for more reference.

  • Related