The Multi-Account Trap in Google Workspace Add-ons (And How to Avoid It)

If you’re building Google Workspace Add-ons or Editor Add-ons, there’s a good chance you’ve encountered mysterious PERMISSION_DENIED errors, especially when using google.script.run in custom sidebars.

The kicker? The same code works flawlessly for some users, and fails catastrophically for others — without any obvious reason.

Welcome to the multi-account execution context problem.

In this article, I’ll break down:

  • When and why this error occurs
  • How to reproduce it
  • What you can do to avoid it (or at least handle it gracefully)
  • My own learnings building real-world Add-ons