apps-script-utils 2.1.1 Help

requireAdmin

function requireAdmin(message?: string): void;

The assertion form of isAdmin, and the one to put at the top of anything destructive. It returns nothing: either the call continues or it does not.

Parameters

Parameter

Type

Description

message (optional)

string

The message of the exception. A default is used when omitted.

Returns

void — nothing; it either passes or throws.

Throws

Exception

Condition

AuthorizationException

the active user is not an administrator.

Examples

Guarding an action

function deleteEverything() { requireAdmin("Only an administrator may run this."); // … }

See also

Source

src/appsscript/admin/requireAdmin.ts

23 September 2026

This documentation was generated with AI (Claude) from the library's source code.