Day 1 – Introduction to Google Apps Script
Goals:
- Understand what Apps Script is.
- Learn where to write and run scripts.
- Write your first script.
Topics:
- What is Apps Script? (JavaScript in Google Workspace)
- Accessing the Script Editor (Extensions → Apps Script in Google Sheets/Docs).
- The
Logger.log()
function.
Code Example:
function helloWorld() {
Logger.log("Hello, Google Apps Script!");
}
Practice:
- Run the function.
- Open View → Logs to see the message.
Quiz (3 questions):
- Apps Script is based on which programming language?
- a) Python
- b) JavaScript ✅
- c) Java
- Where do you open the Apps Script editor in Google Sheets?
- a) File → Settings
- b) Extensions → Apps Script ✅
- c) Tools → Developer
- What function is used to output logs in Apps Script?
- a) Console.log
- b) Print()
- c) Logger.log ✅
Day 2 – Working with Google Sheets
Goals:
- Learn to open a spreadsheet.
- Access and modify cells.
Topics:
SpreadsheetApp.getActiveSpreadsheet()
- Reading and writing values.
Code Example:
function writeToSheet() {
const sheet = SpreadsheetApp.getActiveSpreadsheet().getActiveSheet();
sheet.getRange("A1").setValue("Welcome to Apps Script!");
}
Practice:
- Modify the script to write your name into cell B2.
Quiz (2 questions):
- Which method sets a value into a cell?
- a) setCell
- b) setValue ✅
- c) writeValue
- What object do you use to work with Sheets in Apps Script?
- a) DocsApp
- b) SpreadsheetApp ✅
- c) DriveApp
Day 3 – Reading and Writing Ranges
Goals:
- Read data from multiple cells.
- Write arrays of data back.
Code Example:
function readAndWriteRange() {
const sheet = SpreadsheetApp.getActiveSpreadsheet().getActiveSheet();
const values = sheet.getRange("A1:A5").getValues();
Logger.log(values);
const newValues = [["One"], ["Two"], ["Three"]];
sheet.getRange("B1:B3").setValues(newValues);
}
Practice:
- Read a row of numbers and write them doubled into another column.
Quiz (2 questions):
- What method returns multiple cell values?
- a) getValue
- b) getValues ✅
- c) readRange
- To write an array of values, which method is correct?
- a) setValues ✅
- b) setValue
- c) putValues
Day 4 – Loops and Logic in Apps Script
Goals:
- Use loops (
for
) to process rows. - Apply conditions (
if
).
Code Example:
function markPassed() {
const sheet = SpreadsheetApp.getActiveSheet();
const data = sheet.getRange("A2:A10").getValues();
for (let i = 0; i < data.length; i++) {
if (data[i][0] >= 50) {
sheet.getRange(i+2, 2).setValue("Pass");
} else {
sheet.getRange(i+2, 2).setValue("Fail");
}
}
}
Practice:
- Write a script to label scores above 80 as “Excellent”.
Quiz (2 questions):
- What loop type is commonly used for iterating through rows?
- a) while
- b) for ✅
- c) do-while
- How do you check if a value is greater than 50?
- a) value = 50
- b) value > 50 ✅
- c) value < 50
Day 5 – Custom Functions
Goals:
- Create custom functions for Sheets.
Code Example:
function DOUBLE(number) {
return number * 2;
}
Now use =DOUBLE(5)
directly in a Google Sheet.
Practice:
- Create a custom function
FULLNAME(first, last)
that returns “first last”.
Quiz (2 questions):
- Can Apps Script custom functions be used like normal formulas?
- a) Yes ✅
- b) No
- What keyword is used to return a value?
- a) yield
- b) return ✅
- c) output
Day 6 – Triggers
Goals:
- Understand simple and installable triggers.
- Automate running scripts.
Code Example (onOpen):
function onOpen() {
SpreadsheetApp.getUi()
.createMenu("Custom Menu")
.addItem("Say Hello", "helloWorld")
.addToUi();
}
Practice:
- Add a menu item that clears the sheet.
Quiz (2 questions):
- Which trigger runs when a spreadsheet is opened?
- a) onOpen ✅
- b) onEdit
- c) onLoad
- Where are installable triggers managed?
- a) Extensions → Triggers ✅
- b) File → Settings
- c) Tools → Developer
Day 7 – Google Docs with Apps Script
Goals:
- Work with
DocumentApp
. - Insert text into a document.
Code Example:
function writeDoc() {
const doc = DocumentApp.getActiveDocument();
doc.getBody().appendParagraph("Hello from Apps Script!");
}
Practice:
- Write a script that adds today’s date into a document.
Quiz (2 questions):
- What class is used to work with Google Docs?
- a) DocsApp
- b) DocumentApp ✅
- c) TextApp
- Which method adds a new paragraph?
- a) addText
- b) appendParagraph ✅
- c) insertLine
Day 8 – Gmail Automation
Goals:
- Send emails with
GmailApp
.
Code Example:
function sendEmail() {
GmailApp.sendEmail("example@gmail.com", "Test Email", "This is a test sent from Apps Script.");
}
Practice:
- Send yourself an email with today’s date in the subject.
Quiz (2 questions):
- Which service sends emails?
- a) MailApp ✅
- b) GmailApp ✅
- c) Both ✅ (both work)
- What arguments are required for
sendEmail
?- a) To, Subject, Body ✅
- b) To, CC, BCC
- c) Subject, Body
Day 9 – Google Drive Automation
Goals:
- Access and create files/folders with
DriveApp
.
Code Example:
function createFolder() {
const folder = DriveApp.createFolder("My Apps Script Folder");
Logger.log("Folder created: " + folder.getUrl());
}
Practice:
- Write a script to list all file names in your Drive root folder.
Quiz (2 questions):
- Which class manages Google Drive?
- a) DriveManager
- b) DriveApp ✅
- c) FileApp
- What method creates a folder?
- a) makeFolder
- b) createFolder ✅
- c) newFolder
Day 10 – Putting It All Together (Mini Project)
Goal:
Build a project combining Sheets, Gmail, and Drive.
Project Example – Email Grade Report
function emailGrades() {
const sheet = SpreadsheetApp.getActiveSpreadsheet().getActiveSheet();
const data = sheet.getRange("A2:C10").getValues();
for (let i = 0; i < data.length; i++) {
const name = data[i][0];
const email = data[i][1];
const grade = data[i][2];
const subject = "Your Grade Report";
const body = "Hello " + name + ", your grade is: " + grade;
GmailApp.sendEmail(email, subject, body);
}
}
Practice:
- Extend this to create a PDF report in Drive and attach it to the email.
Quiz (Final Challenge):
- Which Apps Script services were used in this project?
- a) SpreadsheetApp ✅
- b) GmailApp ✅
- c) DriveApp ✅
- What loop structure is best for sending multiple emails?
- a) for ✅
- b) while
- c) do-while
👉 By the end of these 10 days, learners will:
- Understand the Apps Script environment.
- Automate Google Sheets, Docs, Gmail, and Drive.
- Build real-world mini projects.
