enuchi / React-Google-Apps-Script

This is your boilerplate project for developing React apps inside Google Sheets, Docs, Forms and Slides projects. It's perfect for personal projects and for publishing complex add-ons in the Google Workspace Marketplace.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Can only add menu to 1 type of doc/slides/sheet ... ?

sunshineo opened this issue · comments

I tried to have onOpen be like

export const onOpen = () => {
  try {
    const menu = DocumentApp.getUi()
      .createMenu('doc menu')
      .addItem('doc item', 'docFuction')

    menu.addToUi();
  }
  catch (e) {
  }

  try {
    const slidesMenu = SlidesApp.getUi()
      .createMenu('slides menu')
      .addItem('slides item', 'slidesFuction')

    slidesMenu.addToUi();
  }
  catch (e) {
  }
};

But this only worked for doc not slides. If I reverse the order, then it works for slides not doc.
Can my app for both doc and slides?

Not sure. I'd be surprised if it worked. Are you trying to have the same code work for both?

Does it throw an error, or in other words can you print e?

Yes, we want our add on to add menu to both Doc and Slides. (They also pretty much do the same thing of get some content and insert)
And today I'm seeing this code is just working. I'm not sure if I saw it wrong yesterday or I'm seeing things now. Will report back. Thanks!

OK sounds good. Let me know if resolved.

It's working. Thank you!