← Back to Apps Script Trainer

Your first real Apps Script

You do not need previous programming experience. Work through lessons 1–18 for the coding foundations, then return here when you want to use a real Google project.

1. Understand the moving parts

JavaScript is the language. Apps Script is Google’s development platform and runtime. Services such as SpreadsheetApp connect your code to Google products. A bound project belongs to a particular file; a standalone project is independent. This trainer uses a local service model, so its practice results do not change your Google account.

2. Create a practice file

  1. Sign in with an account permitted to use Apps Script. Create a new, disposable Google spreadsheet. Avoid production data while learning.
  2. Name a sheet tab Practice. Keep A1:B2 available for the later write exercise.
  3. Choose Extensions → Apps Script. This creates or opens the bound project. If the option is unavailable, check account and administrator restrictions.
  4. Name the project Apps Script Practice. The editor’s .gs file holds server-side JavaScript.

3. Start with a log

Download the commented first-script starter. Open it as text and copy the code into the editor, replacing its sample function. Save.

  1. Select trainerHello in the function selector.
  2. Select Run. Inspect the execution log for Hello, New coder!
  3. Change the learner name, save and run again. Explain which value changed and which function executed.

If Google asks for access, review the code, permissions and account. Do not proceed when the request or project is unexpected. Availability depends on organizational policies and the services used.

4. Make one deliberate spreadsheet change

  1. Confirm you are using the disposable spreadsheet and the Practice tab exists.
  2. Select trainerWritePractice and run it. Complete the authorization flow only when appropriate for your account and code.
  3. Return to Sheets. A1:B2 should contain a Skill/Status header and First script/Practiced row.
  4. Run it again. It replaces the same rectangle; it does not append duplicate rows.
  5. Inspect Executions if it fails. Record the error, selected function, sheet name and permission state.

5. Learn from common errors

SyntaxError
Check pairs of quotes, parentheses and braces. Fix syntax before investigating service permissions.
ReferenceError
Check spelling and scope. A variable inside a function is not automatically available outside it.
Cannot read properties of null
The selected sheet may not exist. Check the tab name and use a guard.
Authorization required
Check the execution account and required access. Triggers cannot display an interactive authorization prompt while running.
e is undefined
Clicking Run does not create an edit event. Use the Trigger Inspector and a test wrapper.
Lab is not defined
Lab is a trainer-only fixture helper. Do not copy test expressions using Lab into Google.

Your learning route

Complete a lesson by passing its code checks, answering both questions and explaining your reasoning. A passing example is evidence of practice, not proof that code is ready for every real environment.

Official reference

Platform and editor context: Google Apps Script overview. Permission details: Authorization for Google services. Current limits: Quotas and limits. Reviewed October 5, 2026; consult these pages for changes.