Module 15 / 15 — THE FINALE

The Grand Master Project

Building a Live Digital Guestbook from scratch.

You have made it. Today, we aren't learning a new trick; we are performing a whole magic show. We will build a Guestbook where your friends can leave notes that show up live on your Blogger site!

What You Will Learn
  • How to combine doGet and doPost in one script.
  • How to read ALL messages from a sheet and turn them into a list.
  • How to send a professional "Welcome" email to new guestbook signers.
  • How to create a "Live Refresh" button on your blog.
Who Is This For?

This is for the Master Graduate. You have survived the bugs, understood the logic, and practiced your skills. You are now ready to build tools that solve real problems.

Real Life Connection

Think of a Social Media Wall (like Twitter/X or a Facebook Wall).

People type their thoughts, click a button, and the whole world can see it. Behind that "Post" button is a script just like the one you are about to write. It takes the text, saves it in a database, and tells the website to refresh the list.

The "Full Circle" App

To make a guestbook, our script needs two "ears":

  1. Ear 1 (doPost): Listens when someone submits a message. It saves the message and sends a "Thank You" email.
  2. Ear 2 (doGet): Listens when the blog asks for the list of messages. It reads the whole sheet and sends the data back as JSON.
The Master Loop
1. User submits name/message on Blog
2. Script saves to Sheet + Emails User
3. Blog asks Script for updated list
4. Script sends back the whole list
5. Blog displays everyone's messages!
Coding the Brain

This script uses a loop to read all rows in your sheet and pack them into a JSON list. It also handles the incoming data!

function doGet() {
  const data = SpreadsheetApp.getActiveSheet().getDataRange().getValues();
  return ContentService.createTextOutput(JSON.stringify(data));
}

function doPost(e) {
  // Save and Email logic here!
}
The Master "Guestbook" Script

Paste this into your Apps Script editor. **Deploy** as a Web App (Access: Anyone) and keep the URL handy.

function doGet() { const sheet = SpreadsheetApp.getActiveSheet(); const data = sheet.getDataRange().getValues(); // Remove the header row data.shift(); return ContentService.createTextOutput(JSON.stringify(data)) .setMimeType(ContentService.MimeType.JSON); } function doPost(e) { const name = e.parameter.name; const email = e.parameter.email; const msg = e.parameter.message; // 1. Save to Sheet SpreadsheetApp.getActiveSheet().appendRow([new Date(), name, msg]); // 2. Send Thank You Email MailApp.sendEmail(email, "Thanks for signing my Guestbook!", "Hi " + name + ", your message is live!"); return ContentService.createTextOutput("Success"); }
The Final Blogger Interface

When you refresh your Blogger page, your JavaScript will call doGet. The script reads the whole spreadsheet, sends it back, and your blog will loop through the rows to show a beautiful list of messages.

๐ŸŽ“ Certificate of Completion ๐ŸŽ“

This certifies that you are now a Google Apps Script Master. You have the skills to automate, communicate, and build.

Your journey has just begun!

The Final Check
Click to see why your Guestbook might be shy!

1. Empty Sheet: If there are no rows in the sheet, getDataRange() will fail. Add one row of "Fake Data" to start!

2. New Version: I will repeat this forever: If you change the code, you MUST create a New Version in Manage Deployments!

3. Email Quota: If you are testing with your friends and send 100 emails quickly, Google might tell you to wait until tomorrow.

The "Ultimate" Challenge

Can you add a Search Bar to your guestbook? Using the logic from Module 4 (Conditions), can you filter the list to only show messages from a certain name?

Who Else Uses This?

Every website with a comment section (YouTube, Instagram, Reddit) uses this exact architecture. There is a database where comments live, a script that handles posting, and a script that handles showing them to you. You've just built the engine of a social network!

Final Course Summary

You have traveled through 15 modules. You've learned variables, logic, loops, functions, sheets, emails, and web apps. You have the power to turn a blank page into a living tool.

Status: MASTER GRADUATE ๐Ÿ† | Level: PRO DEVELOPER ๐Ÿš€