Best practices

Improve your users' overall experience by following these guides for add-on design.

General best practices

You are encouraged to follow the following best practices for all add-ons you develop.

Determine add-on ownership before starting

add-ons are defined by Apps Script projects, which must be owned by a specific account or else placed in a shared drive. Before coding an add-on, determine what account should own the project, and what account acts as its publisher. Also determine what accounts are to act as collaborators, and make sure those accounts have access to the script project and its associated Cloud platform project.

Extend Google Workspace, don't replicate it

add-ons are meant to provide new capabilities to the Google Workspace applications they extend, or else automate complex tasks. add-ons that merely replicate functionality already within the application or ones that don't make replicate significant improvements to a workflow aren't likely to pass add-on review for publication.

Keep the scopes narrow

When defining your scopes explicitly, always choose the least-permissive set of scopes possible. For example, don't have your add-on request full access to the user's Calendar with the scope if it only needs read access. For read-only access, use the scope.

Avoid relying too much on libraries

Using Apps Script libraries can cause your add-on to run more slowly than it would if all the Apps Script code were contained within a single script project. Although Apps Script libraries work in add-ons, you may run into performance reductions if you use them. Avoid including unnecessary libraries in your project, and consider ways to reduce your add-on's reliance on them.

The latency described above only applies to Apps Script projects being used as server-side libraries. You can use client-side JavaScript libraries like jQuery freely without encountering this latency.

Editor Add-on best practices

The following best practices only apply to Editor Add-on}.

Place interface HTML and client-side JavaScript in their own script files

You can create multiple script files in an Apps Script project. It's easier to manage a complex add-on if you place the HTML and JavaScript that defines the add-on sidebars and dialogs in script files dedicated to them.

Test throughly in different authorization modes

When testing your add-on, be sure to try configurations that have different files and different authorization states.