A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://developers.google.com/apps-script/reference/document/document-app below:

Class DocumentApp | Apps Script

Class DocumentApp

Stay organized with collections Save and categorize content based on your preferences.

DocumentApp

The document service creates and opens Documents that can be edited.

// Open a document by ID.
// TODO(developer): Replace the ID with your own.
let doc = DocumentApp.openById('DOCUMENT_ID');

// Create and open a document.
doc = DocumentApp.create('Document Name');
Detailed documentation create(name)

Creates and returns a new document.

// Create and open a new document.
const doc = DocumentApp.create('Document Name');
Parameters Name Type Description name String The new document's name. Return

Document — The new document instance.

Scripts that use this method require authorization with one or more of the following scopes:

getActiveDocument()

Returns the document to which the script is container-bound. To interact with document to which the script is not container-bound, use openById(id) or openByUrl(url) instead.

// Get the document to which this script is bound.
const doc = DocumentApp.getActiveDocument();
Return

Document — the document instance

Authorization

Scripts that use this method require authorization with one or more of the following scopes:

getUi()

Returns an instance of the document's user-interface environment that allows the script to add features like menus, dialogs, and sidebars. A script can only interact with the UI for the current instance of an open document, and only if the script is bound to the document. For more information, see the guides to menus and dialogs and sidebars.

// Add a custom menu to the active document, including a separator and a
// sub-menu.
function onOpen(e) {
  DocumentApp.getUi()
      .createMenu('My Menu')
      .addItem('My menu item', 'myFunction')
      .addSeparator()
      .addSubMenu(
          DocumentApp.getUi()
              .createMenu('My sub-menu')
              .addItem('One sub-menu item', 'mySecondFunction')
              .addItem('Another sub-menu item', 'myThirdFunction'),
          )
      .addToUi();
}
Return

Ui — an instance of this document's user-interface environment

openById(id)

Returns the document with the specified ID. If the script is container-bound to the document, use getActiveDocument() instead.

// Open a document by ID.
// TODO(developer): Replace the ID with your own.
const doc = DocumentApp.openById('DOCUMENT_ID');
Parameters Name Type Description id String The ID of the document to open. Return

Document — The document instance.

Authorization

Scripts that use this method require authorization with one or more of the following scopes:

openByUrl(url)

Opens and returns the document with the specified URL. If the script is container-bound to the document, use getActiveDocument() instead.

// Open a document by URL.
const doc = DocumentApp.openByUrl(
    'https://docs.google.com/document/d/1234567890abcdefghijklmnopqrstuvwxyz_a1b2c3/edit',
);
Parameters Name Type Description url String the URL of the document to open Return

Document — the document instance

Authorization

Scripts that use this method require authorization with one or more of the following scopes:

Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.

Last updated 2024-12-02 UTC.

[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2024-12-02 UTC."],[[["The `DocumentApp` service in Google Apps Script allows you to programmatically create, open, and edit Google Documents."],["You can open existing documents using their ID or URL, or create new documents with a specified name."],["`DocumentApp` provides access to a document's user interface, enabling features like custom menus, dialogs, and sidebars."],["It offers a variety of properties and methods to manipulate document content, formatting, and elements."],["Using this service requires specific authorization scopes related to document access and modification."]]],[]]


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4