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.
MIT License
1.32k stars 171 forks source link

How to deploy a google workspace addon using this? #208

Closed jryebread closed 4 months ago

jryebread commented 6 months ago

Hey there, great project, I'm a little confused on how this would work as a google sheets addon, because if my server isnt running, the sidebar panel shows as not found 'https://localhost:3000/sidebar-about-page-impl.html is not found"

So does this mean I need to host the project on a server somewhere and change it from localhost to that server ip?

Any other tips/guide for hosting this as a google sheets addon on the workspace marketplace?

enuchi commented 6 months ago

That's just for local development. Run npm run deploy and your react app will be deployed in the Google environment.

You can check out more details in the readme here and in Google's docs.

jryebread commented 6 months ago

@enuchi Pls help

Do you know how to update the installation message that comes up after the published addon is installed? I get this weird one from google I dont think I defined this anywhere! image

Also after installation I have to refresh the whole page for the menu bar to show up, otherwise all i see is the help page, do you know why that is? :( I tested it with other extensions and they instantly show the menu bars.

image

jryebread commented 6 months ago

After refreshing the page it works but would love to know why it doesn't show the menu item automatically after install like the other extensions?

image

enuchi commented 6 months ago

@jryebread I doubt the installation message can be customized -- that seems like google boilerplate.

You can look at onInstall(e) here: https://developers.google.com/apps-script/guides/triggers#oninstalle

You could just call onOpen from it, but note some of the caveats in the docs linked on where the add on is installed.

/**
 * The event handler triggered when installing the add-on.
 * @param {Event} e The onInstall event.
 * @see https://developers.google.com/apps-script/guides/triggers#oninstalle
 */
function onInstall(e) {
  onOpen(e);
}
jryebread commented 6 months ago

Thank you so much was looking for something like that!

This ones not super important but do you happen to know how to customize this part of the addon? mine just sais "apps script application" and i thought publishing to store would update that name image

enuchi commented 6 months ago

Just googling it...

https://spreadsheet.dev/custom-sidebar-in-google-sheets

See "Setting a custom title for the sidebar in Google Sheets"