[null,null,["最后更新时间 (UTC):2025-04-09。"],[[["\u003cp\u003eEnhance user experience by adhering to add-on design guidelines that focus on ownership, functionality, and security.\u003c/p\u003e\n"],["\u003cp\u003eDesign add-ons to extend Google Workspace capabilities, rather than duplicating existing features, to ensure successful publication.\u003c/p\u003e\n"],["\u003cp\u003ePrioritize security by minimizing the scope of access your add-on requires, requesting only necessary permissions.\u003c/p\u003e\n"],["\u003cp\u003eOptimize performance by limiting reliance on external libraries and, if applicable to Editor add-ons, strategically organizing code within dedicated script files.\u003c/p\u003e\n"],["\u003cp\u003eFor Editor add-ons, thorough testing across various authorization modes is crucial to ensure functionality and user experience.\u003c/p\u003e\n"]]],["Before coding, determine the add-on's ownership, publisher, and collaborators, ensuring all have access to the project. Prioritize extending, not replicating, Google Workspace functionality and use the narrowest scopes possible when defining permissions. Avoid over-reliance on Apps Script libraries due to potential performance issues. Organize complex add-ons by placing HTML and JavaScript in dedicated script files. Thoroughly test the add-on in various authorization modes and file configurations.\n"],null,["# Best practices\n\nImprove your users' overall experience by following these guides for\nadd-on design.\n\nGeneral best practices\n----------------------\n\nYou are encouraged to use the following best practices for all\nadd-ons you develop.\n\n### Determine add-on ownership before starting\n\nAdd-ons are defined by Apps Script projects, which\nmust be owned by a specific account or else placed in a [shared\ndrive](/workspace/drive/v3/web/about-shareddrives). Before coding an\nadd-on, determine what account should own the project,\nand what account acts as its publisher. Also determine what accounts are to act\nas collaborators, and make sure those accounts have access to the script project\nand its associated\n[Google Cloud project](/apps-script/guides/cloud-platform-projects).\n| **Note:** It's important to plan add-on ownership. If the add-on owner leaves your organization, you must make sure ownership is transferred or else you could lose the ability to update and manage your add-on. For this reason, it may be best to create an organization account specifically to own and publish your organization's add-ons. You can also use a shared drive to act as the script project owner, but a specific account must act as the add-on publisher.\n\n### Extend Google Workspace, don't replicate it\n\nAdd-ons are meant to provide new capabilities to the\nGoogle Workspace applications they extend, or else automate complex tasks.\nAdd-ons that merely replicate functionality already within the\napplication or ones that don't make significant improvements to a workflow\naren't likely to pass [add-on review](/workspace/marketplace/about-app-review) for publication.\n\n### Keep the scopes narrow\n\nWhen [defining your scopes\nexplicitly](/apps-script/concepts/scopes#set-explicit), always choose the\nleast-permissive set of scopes possible. For example, don't have your\nadd-on request full access to the user's\nCalendar with the `https://www.googleapis.com/auth/calendar`\nscope if it only needs read access. For read-only access, use the\n`https://www.googleapis.com/auth/calendar.readonly` scope.\n\n### Avoid relying too much on libraries\n\nUsing Apps Script [libraries](/apps-script/guides/libraries) can\ncause your add-on to [run more\nslowly](/apps-script/guides/support/best-practices#avoid_libraries_in_ui-heavy_scripts)\nthan it would if all the Apps Script code were contained within a\nsingle script project. Although Apps Script libraries work in\nadd-ons, you might run into performance reductions if you use\nthem. Avoid including unnecessary libraries in your project, and consider ways\nto reduce your add-on's reliance on them.\n\nThe latency described above only applies to Apps Script projects\nbeing used as server-side libraries. You can use client-side JavaScript\nlibraries like jQuery freely without encountering this latency.\n\nEditor add-on best practices\n----------------------------\n\nThe following best practices only apply to\nEditor add-on.\n\n### Place interface HTML and client-side JavaScript in their own script files\n\nYou can create multiple script files in an Apps Script project.\nIt's easier to manage a complex add-on if you place the\nHTML and JavaScript that defines the add-on sidebars\nand dialogs in script files dedicated to them.\n\n### Test thoroughly in different authorization modes\n\nWhen [testing your add-on](/workspace/add-ons/how-tos/testing-editor-addons), be\nsure to try configurations that have different files and different\n[authorization\nstates](/workspace/add-ons/concepts/editor-auth-lifecycle#states)."]]