← Methods Studio

Bound and standalone: choose your setup

This Studio teaches built-in service methods. The function runTask is a small entry point around those calls, not the subject of the lesson.

NeedProject and method
A menu or sidebar inside one SheetBound project; SpreadsheetApp.getUi()
Work with the bound parent in its editorBound project; getActiveSpreadsheet()
A scheduled job or several known filesExplicit IDs, often a standalone project; openById()
Drive inventory or document generationEither project type with authorized access; explicit resource methods

Bound path

  1. Create a disposable Sheet, with a Tasks tab containing Name, Minutes, Status headers and fictional rows. Add an empty Report tab.
  2. Choose Extensions → Apps Script. This project belongs to that Sheet.
  3. Download a workshop’s code, replace example IDs if used, save and select runTask. To see its return value, use a wrapper such as function test(){console.log(runTask());} and run test.
  4. Read permission requests before authorizing. Check Executions for logs or errors.
  5. For the menu workshop, add function onOpen(){runTask();}, save and reload the spreadsheet. The named menu handler must exist.

Special active-file methods rely on a supported bound execution context. They are not available merely because a bound project is deployed as a web app. UI interaction requires the open bound editor.

Google: container-bound scripts ↗

Standalone path

  1. Create a project at script.google.com.
  2. Create the test spreadsheet, folder or other target separately. Copy its ID from the relevant URL/settings.
  3. Replace book-demo, folder-demo, template, doc-demo and other fixture IDs in downloaded examples. They are not real resources.
  4. Use explicit methods such as SpreadsheetApp.openById(id), DriveApp.getFolderById(id) or DocumentApp.openById(id).
  5. Run manually and verify the result before creating a trigger. No web-app deployment is required to run a manual function.
  6. Install a trigger once under the intended account; inspect the Triggers page and use scoped cleanup afterward.

Opening by ID does not confer access. The executing account still needs the right permissions. Installable triggers run as their creator.

Google: standalone scripts ↗ · Installable triggers ↗

Read an object chain

SpreadsheetApp.openById(id)  // Spreadsheet
  .getSheetByName('Tasks')   // Sheet or null
  .getRange('A2:C4')         // Range
  .getValues();             // JavaScript array of rows

Each method belongs to the object before the dot. Check nullable results before continuing. A getValues array is a snapshot, not a live Range. To change cells call a setter on the Range.

Use the simulator honestly

The local practice engine logs modeled method calls and resource changes. It never authorizes your account, sends messages or installs Google triggers. Supported methods are a teaching subset; consult each linked reference for real behavior and limits. Lab.reset and Lab.snapshot exist only in this Studio and do not belong in your real scripts.

Creating files, drafts, events and triggers repeatedly can create duplicates. The project starters default to preview mode. Verify output ownership, recipients and repeat behavior before automating.