Class EditorFileScopeActionResponseBuilder

  • EditorFileScopeActionResponseBuilder helps create responses for actions within Google Editors (Docs, Sheets, Slides).

  • It primarily offers two methods: build() to finalize the response and requestFileScopeForActiveDocument() to request necessary file access permissions.

  • requestFileScopeForActiveDocument() specifically asks for 'drive.file' scope, enabling the add-on to interact with the user's current document.

  • To use this functionality, you need to declare the 'drive.file' scope in your add-on's manifest file.

EditorFileScopeActionResponseBuilder

A builder for EditorFileScopeActionResponse objects.

Methods

MethodReturn typeBrief description
build()EditorFileScopeActionResponseBuilds the current Editor action response.
requestFileScopeForActiveDocument()EditorFileScopeActionResponseBuilderRequests the drive.file scope for the current active Editor document.

Detailed documentation

build()

Builds the current Editor action response.

Return

EditorFileScopeActionResponse — A validated EditorFileScopeActionResponse.


requestFileScopeForActiveDocument()

Requests the drive.file scope for the current active Editor document.

// Display a permissions dialog to the user, requesting `drive.file` scope for
// the current document on behalf of this add-on.
CardService.newEditorFileScopeActionResponseBuilder()
    .requestFileScopeForActiveDocument()
    .build();

Note: To call this method, you must add the drive.file scope to the add-on's manifest.

Return

EditorFileScopeActionResponseBuilder — This object, for chaining.