5 Basics to Know for Coding

5 coding basics for Google Apps Script

Coding with Google Apps Script

As a G Suite user you may find yourself wishing… “Why can’t I …. in Google Docs/Sheets/Forms/Slides?” You can if you know how to code! Go to script.google.com to get started with standalone coding or in Docs, Sheets, or Slides use the Tools menu and choose “Script Editor.” This allows you to create code specifically for that document to make a template.

TemplateTab

TemplateTab is one of my favorite things I’ve coded. In a Google Sheets spreadsheet I used the Tools menu and the Script Editor to code the ability to take a list of student names and create a copy of a graphic organizer within the same spreadsheet for EACH student. A new tab for each student will be created, with their name on it, along the bottom. Share the spreadsheet with edit access with your students and have only ONE document to open rather than 30.

Alice Keeler Add-ons

You can find many of my coding projects at

5 Google Apps Script Basics

Google Apps Script is based on JavaScript. Knowing a little JavaScript will help you significantly in coding Google Apps Script.

1. Function

Each chunk of code is contained in a function. If your coding project has multiple steps you may want to set up multiple functions to allow for different features.

Notice in TemplateTab next to the Help menu is a menu I coded. The menu itself is one function; a set of code to tell the spreadsheet to have a menu. There are multiple options. The main option is to “Run TemplateTab.” That option is a separate function from the function to make the menu. Each menu item is a separate function I wrote.

TemplateTab menu

To create a function in Google Apps Script type the word function in all lower case. If you spelled it correctly it will turn purple. Put a space and then what you want to name your function. It has to be a single word. Notice for TemplateTab that I smooshed the words together to make one word. This is a common technique. Lowercase the first word, capitalize the first letter of any subsequent words.

menu of functions

This is a list of the function names I have for my TemplateTab script. Notice they are all one word.

After deciding on your function name, put a set of parenthesis to contain your parameters. Almost always you have no parameters so your parenthesis are blank. Then you need a set of curly braces to indicate the start and end of the function.

function templateTab(){
}

2. Variables

Variables store values so you can reuse values or code without having to retype the same thing you had already typed.

Define a variable by starting with the 3 letters var and then a space and what you want to name your variable (single word) and then an equals sign.

Want More Help with This? Become a Premium Member

3. Semi-Colon

Each line of code needs to end in a semi-colon to tell the script… this is the end of the line of code! This is where coding gets “fun.” You will forget a semi-colon at the end of a line and then your code won’t run and you have to figure out where you forgot the semi-colon.

Add a semi colon after the line of code

4. Spaces

Extra spaces and extra returns do not affect your code. Space out your code so it’s easier to view and read. Push enter several times to separate out different parts of your code.

Use two slashes // to create a COMMENT. This is like a post it note in your code. Consider pushing enter several times and typing 2 slashes to make a comment about what code is coming next.

Press enter several times and use 2 slashes to comment what comes next in your code.

5. GOOGLE IT!

One of the best things of living in the 21st century is that when you don’t know something you can “Google it.” If you want to code a date into your Google Apps document do a Google search for JavaScript date. Whatever you want to be able to do you can probably use the search terms “Google Apps Script” and what you’re looking for or “JavaScript” and what you’re looking for. Copy and paste code off the internet! You only need the idea and some perseverance to FIND the code that does what you want.

About Your Data PII

App’s use and transfer to any other app of information received from Google APIs will adhere to Google API Services User Data Policy, including the Limited Use requirements.

Compliance with Google’s Limited Use Policy

AliceKeeler LLC is committed to complying with the Google API Services User Data Policy, including the Limited Use requirements. Our use and transfer of information received from Google APIs adhere strictly to these policies, ensuring data is used only for the purposes necessary to provide and improve the Service.

  • Limited Use of Google User Data: The Service only accesses and uses Google user data in ways that are essential for the functioning and improvement of the Service, and not for independent purposes.
  • Transparency and Consent: We provide clear notice and obtain explicit consent from users before accessing or using their Google user data.
  • Data Minimization: We access only the minimum amount of data necessary from Google APIs to provide our Service.
  • Security Measures: We implement robust security measures to protect the confidentiality, integrity, and availability of Google user data.
  • Third-Party Sharing Restrictions: We do not share Google user data with third parties unless it is strictly necessary for the functioning of the Service and compliant with the Google API Services User Data Policy.
  • Google API Services User Data Policy: For more information about how we comply with the Google API Services User Data Policy, including the Limited Use requirements, please visit Google API Services User Data Policy.

For any questions or concerns regarding our use of Google user data, please contact us at info@alicekeeler.com.

© 2025 All Rights Reserved.

💥 FREE OTIS WORKSHOP

Join Alice Keeler, Thursday Oct24th or register to gain access to the recording.
Create a free OTIS account.

Join Alice Keeler for this session for using FigJam to start every lesson.

Exit this pop up by pressing escape or clicking anywhere off the pop up.