<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Jesutoni Aderibigbe</title>
    <description>The latest articles on DEV Community by Jesutoni Aderibigbe (@toniaderibigbe).</description>
    <link>https://dev.to/toniaderibigbe</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F1073499%2F4c525057-9fec-4f95-9f32-959d02558652.jpg</url>
      <title>DEV Community: Jesutoni Aderibigbe</title>
      <link>https://dev.to/toniaderibigbe</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/toniaderibigbe"/>
    <language>en</language>
    <item>
      <title>Automation 102 with Google Apps Script</title>
      <dc:creator>Jesutoni Aderibigbe</dc:creator>
      <pubDate>Sat, 24 May 2025 19:30:30 +0000</pubDate>
      <link>https://dev.to/toniaderibigbe/automation-102-with-google-apps-script-2kc5</link>
      <guid>https://dev.to/toniaderibigbe/automation-102-with-google-apps-script-2kc5</guid>
      <description>&lt;p&gt;In the last article, we started a discourse on what Google Apps Script meant and how it could be integrated into our various Google workspaces. This article will build a structure from the foundation that has been laid by our previous article. Today, we will&lt;br&gt;
be learning how to write basic logic using JavaScript fundamentals inside Apps Script while trying to automate with Google Forms and Gmail.&lt;/p&gt;
&lt;h2&gt;
  
  
  Functions, the building blocks for Apps Script.
&lt;/h2&gt;

&lt;p&gt;As stated in the first tutorial, Functions are reusable blocks of code that help perform a specific task. They help organize your code by making it easier to read and preventing any forms of redundancy.&lt;br&gt;
Functions should describe what they do. For example, if you want a function that sends an email, you could call it &lt;code&gt;sendEmail&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;This is a perfect example of a function that greets users&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;function greetUser() {
  Logger.log("Hello from Apps Script!");
}

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Variables – Storing and Using Data
&lt;/h2&gt;

&lt;p&gt;Think of variables like a container that stores values. Variables let you store texts, numbers, and lists.&lt;br&gt;
For example&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;let name = "John";
const age = 30;
var message = "Welcome!";

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If we add this with the function we had written before&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;function showUserInfo() {
  let name = "Alice";
  const country = "Nigeria";
  Logger.log("Name: " + name);
  Logger.log("Country: " + country);
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Logic - Making Decisions based on the &lt;code&gt;if/else&lt;/code&gt; conditions
&lt;/h2&gt;

&lt;p&gt;At its core, programming is about instructing a computer to perform tasks. A significant part of this involves making decisions. &lt;code&gt;if/else&lt;/code&gt; statements are the foundational building blocks for introducing logic and decision-making into your code.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;if&lt;/code&gt; statement: This allows a block of code to be executed only if a specified condition is true.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;if (temperature &amp;gt; 25) {
    print("It's hot outside!")
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;code&gt;else&lt;/code&gt; statement: This provides an alternative block of code to be executed if the if condition (and any subsequent else if conditions) is false.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;if (isRaining) {
    wearRaincoat()
} else {
    wearLightJacket()
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Understanding the &lt;code&gt;switch-case&lt;/code&gt; Statement
&lt;/h2&gt;

&lt;p&gt;Imagine you have to write multiple conditions for a complex task. It’s not considered good practice to use numerous if-else statements. In such cases, a switch-case statement is a better and more organized alternative.&lt;/p&gt;

&lt;p&gt;The switch-case statement is another control flow mechanism used for decision-making, offering an alternative to long chains of if-else if-else statements, especially when you are checking a single variable against multiple possible constant values.&lt;/p&gt;

&lt;p&gt;How it Works:&lt;/p&gt;

&lt;p&gt;The &lt;code&gt;switch&lt;/code&gt; statement evaluates an expression once. The value of the expression is then compared with the values of each case label.&lt;/p&gt;

&lt;p&gt;If a match is found, the code block associated with that case is executed.&lt;br&gt;
The &lt;code&gt;break&lt;/code&gt; keyword (usually used at the end of each case block) is crucial. It terminates the switch statement once a match is found and its code is executed, preventing "fall-through" to subsequent case blocks.&lt;br&gt;
The &lt;code&gt;default&lt;/code&gt; keyword is optional and acts like an else clause. If no case matches the expression's value, the code block under default is executed.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;switch (expression) {
    case value1:
        // code to execute if expression equals value1
        break;
    case value2:
        // code to execute if expression equals value2
        break;
    // ... more cases
    default:
        // code to execute if no case matches
        break;
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Loops – Repeating Tasks
&lt;/h2&gt;

&lt;p&gt;Use loops to repeat actions multiple times (e.g., send multiple emails, or check multiple rows in a sheet).&lt;br&gt;
We have &lt;code&gt;for&lt;/code&gt; loops&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;for (let i = 0; i &amp;lt; 5; i++) {
  Logger.log("Step " + i);
}

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;We have forEach which is commonly used for arrays&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;let fruits = ["apple", "banana", "orange"];
fruits.forEach(function(fruit) {
  Logger.log(fruit);
});

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If we put all we have been learning together, we would have something like this&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;function checkUsers() {
  let users = ["John", "Mary", "Sam"];
  for (let i = 0; i &amp;lt; users.length; i++) {
    if (users[i] === "Mary") {
      Logger.log(users[i] + " is the admin.");
    } else {
      Logger.log("Hello, " + users[i]);
    }
  }
}

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Having laid this background, let's automate real tasks while using Google Forms to send emails on each trigger&lt;/p&gt;

&lt;h2&gt;
  
  
  Automating Tasks with Google Forms + Apps Script
&lt;/h2&gt;

&lt;p&gt;To make this blog easier to follow, I would break each point into different steps&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Create a form on forms.google.com&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Add fields like &lt;code&gt;Name&lt;/code&gt;, &lt;code&gt;Email&lt;/code&gt;, and &lt;code&gt;Message&lt;/code&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;In the &lt;strong&gt;Form editor&lt;/strong&gt;, click &lt;strong&gt;Responses &amp;gt; Link to Sheets&lt;/strong&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Choose “Create new spreadsheet”&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Click Extensions &amp;gt; Apps Script&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Paste this code:&lt;br&gt;
&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;function sendEmailOnFormSubmit(e) {
  const responses = e.values; // All answers in order
  const name = responses[1];  // First question
  const email = responses[2]; // Second question
  const message = responses[3]; // Third question

  const subject = `Hello ${name}, we got your message!`;
  const body = `Hi ${name},\n\nThanks for contacting us.\n\nYou said: "${message}"\n\nWe'll reply soon!\n\nRegards,\nYour Team`;

  MailApp.sendEmail(email, subject, body);
}

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Let me break this down for you:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;code&gt;function sendEmailOnFormSubmit(e) {
&lt;/code&gt; This defines a function named sendEmailOnFormSubmit.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;It takes one parameter: e (short for event object).&lt;/p&gt;

&lt;p&gt;The &lt;code&gt;e object&lt;/code&gt;is automatically passed to the function when it’s triggered by a form submission. It contains information about the submitted form response.&lt;/p&gt;

&lt;p&gt;2.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;  const responses = e.values;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;code&gt;e.values&lt;/code&gt; is an array of all the responses from the submitted form. Each item corresponds to each response based on the order to which they appear in the form&lt;/p&gt;

&lt;p&gt;3.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;  const name = responses[1];
  const email = responses[2];
  const message = responses[3];

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Extracts specific values from the responses array. Make sure your form fields are in this exact order, or adjust the indices accordingly.&lt;/p&gt;

&lt;p&gt;4.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;  MailApp.sendEmail(email, subject, body);

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This sends an email using Apps Script’s built-in MailApp service with the given subject and body.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Back to our discourse&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;In the script editor, click the clock icon (Triggers) on the left.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Click “+ Add Trigger”&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Choose function: sendEmailOnFormSubmit&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Event type: From spreadsheet&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Trigger type: On form submit&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Click Save and authorize the script (you’ll be prompted)&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Submit a response in your Google Form&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Check the email inbox you entered — you’ll receive a custom email&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Note on Permissions
&lt;/h2&gt;

&lt;p&gt;The first time you run or trigger a script, you’ll need to authorize it. Apps Script will ask for permissions like: &lt;code&gt;View and manage spreadsheets&lt;/code&gt;, &lt;code&gt;Send email on your behalf&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;It's time to go😔😟🥺&lt;/p&gt;

&lt;p&gt;I hope you were also able to follow along and practice. In our next tutorial, we will be learning how to do some complex tasks with Google Drive and Docs using Google Apps Script&lt;/p&gt;

&lt;p&gt;See you next time!&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>tutorial</category>
      <category>productivity</category>
      <category>softwaredevelopment</category>
    </item>
    <item>
      <title>Automation 101 with Google Apps Script</title>
      <dc:creator>Jesutoni Aderibigbe</dc:creator>
      <pubDate>Fri, 16 May 2025 08:12:00 +0000</pubDate>
      <link>https://dev.to/toniaderibigbe/automation-101-with-google-apps-script-18l</link>
      <guid>https://dev.to/toniaderibigbe/automation-101-with-google-apps-script-18l</guid>
      <description>&lt;p&gt;Last year, while I was interning at Hordanso LLC, my manager asked me to learn Google Apps Script. I had never heard of it before or experienced its capabilities, as my primary stack has always been Flutter. Fast forward a year later, a friend mentioned that he wanted to send auto-generated emails in response to forms filled out by his users. I decided to look into how this could be done and discovered the easiest automation tool for the job—Google Apps Script. I decided to play around with it and document my learnings.&lt;/p&gt;

&lt;h2&gt;
  
  
  INTRODUCTION
&lt;/h2&gt;

&lt;p&gt;In this first course, we will be learning the following:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Introduction to Google Apps Script.&lt;/li&gt;
&lt;li&gt;How to Open the Script Editor in Google Sheets, Docs, or Forms.&lt;/li&gt;
&lt;li&gt;Understanding the Script Editor Interface&lt;/li&gt;
&lt;li&gt;Your First Script: Hello World&lt;/li&gt;
&lt;li&gt;How to Run a Script and View Logs&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;What is Google Apps Script, and why is it important?&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;Google Apps Script is a free cloud-based scripting language developed by Google. It allows you to automate, customize, and extend Google Workspace apps like Google Sheets, Docs, Slides, Forms, Gmail, Calendar, and more. It is based on modern JavaScript. In other words, if you are familiar with the basic syntax of JavaScript you are already 60% ready to build your very first application&lt;/p&gt;

&lt;p&gt;Unlike traditional programming, Apps Script runs entirely on Google's servers, meaning you don’t need to install anything locally. You write your code in the browser, and it integrates seamlessly with Google’s cloud apps.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;Why is it important, and what can it be used for?&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;It is being said that when the purpose of a thing is not known, abuse is very inevitable. In other words, if you don't see the need for automation with your traditional system of performing tasks, you will spend more time doing it. Google Apps Script is important for the following reasons:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;It saves time by automating repetitive tasks&lt;br&gt;
Instead of manually copying data, formatting documents, or sending emails, you can write scripts that do these tasks for you automatically. So think of creating a mini-bot that automates complex tasks for you while working with the Google Workspace.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;It enhances your Google Workspace tools&lt;br&gt;
You can add custom menus, create buttons, or build sidebars and dialogs to improve your productivity within Sheets, Docs, or Forms.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;It connects multiple Google services easily&lt;br&gt;
For example, automatically send a calendar invite when a form is submitted, or generate a PDF report from spreadsheet data and email it to your team.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;It can build custom workflows and apps without needing complex infrastructure&lt;br&gt;
Apps Script lets you create lightweight web apps, dashboards, or approval systems that run directly on Google’s cloud.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Having said this, what are the things that can be done with Google Apps Script?&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Automate email sending — send personalized bulk emails or automatic reminders.&lt;/li&gt;
&lt;li&gt;Manage spreadsheets — import, clean, format data, or generate reports automatically.&lt;/li&gt;
&lt;li&gt;Create custom Google Forms behavior — auto-respond, route responses, or validate inputs.&lt;/li&gt;
&lt;li&gt;Schedule and manage calendar events — create, update, or send invites based on data.&lt;/li&gt;
&lt;li&gt;Generate documents and PDFs — fill templates with data and share them.&lt;/li&gt;
&lt;li&gt;Build internal tools or web apps — create dashboards, approval workflows, or feedback forms.&lt;/li&gt;
&lt;li&gt;Automate file management — organize Google Drive files and folders based on rules.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Getting Started
&lt;/h2&gt;

&lt;p&gt;To get started in your workspace, click on whatever tool you want to use (&lt;em&gt;sheets, docs, or even slides&lt;/em&gt;). In the menu bar, click on &lt;strong&gt;Extensions&lt;/strong&gt;, then select &lt;strong&gt;Apps Script&lt;/strong&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Understanding the Google Apps Script Editor
&lt;/h2&gt;

&lt;p&gt;To run the Google Apps Script syntax, there is an online editor that helps compile and sync your results. This editor allows you to write, test, and manage your scripts. The beautiful thing about this editor is that you don't have to install any dependencies or have any laptop specifications. Just the internet and adequate permissions, and you are good to go.&lt;/p&gt;

&lt;p&gt;The editor has the following components:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Overview&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Editor&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Project History&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Triggers&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Executions&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Project Settings&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Here is the breakdown of the key components of the editor:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;File Editor (Code Editor Panel)&lt;/strong&gt;: &lt;/p&gt;

&lt;p&gt;This is the main area where you write your code. You write your functions here using the JavaScript-like syntax.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Each script project starts with a default file named Code.gs.&lt;/li&gt;
&lt;li&gt;You can add more files using the “+” button (for &lt;strong&gt;.gs* or **html&lt;/strong&gt; files).&lt;/li&gt;
&lt;li&gt;Use &lt;strong&gt;.gs&lt;/strong&gt; for your main scripts (like &lt;strong&gt;.js&lt;/strong&gt;) and *&lt;em&gt;.html *&lt;/em&gt; for building custom dialogs/sidebars.&lt;/li&gt;
&lt;li&gt;Auto-saves your code as you type.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Files Pane (Sidebar on the left)&lt;/strong&gt;: &lt;br&gt;
This shows all your project files, including:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;.gs (script files)&lt;/li&gt;
&lt;li&gt;.html (for dialogs, sidebars, web apps)&lt;/li&gt;
&lt;li&gt;appsscript.json (the project’s manifest file)
&lt;em&gt;You can edit the names of any of these files by right-clicking.&lt;/em&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Execution Logs:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;These logs help monitor your success and failure rate. Think of it like your terminal on your favorite &lt;em&gt;IDE&lt;/em&gt;. It shows the function name and execution status (success, failure), duration, timestamp, and error messages. You can log your results using&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Logger.log("Some message");
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Triggers&lt;/strong&gt;: &lt;/p&gt;

&lt;p&gt;Think of it like a gun and a bullet; the gun can be fired at certain times based on the handler. The same applies to triggers too. It allows you to automate tasks based on your preferences, like what happens when a form is submitted._ To use this,&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Click the clock icon (Triggers) in the left sidebar or use Edit &amp;gt; Triggers.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;You’ll see the Trigger Dashboard, where you can:&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Add a new trigger (time-based, event-based, etc.)&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;View and delete existing triggers&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Set function, frequency, and event source.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Project Settings:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Click the gear icon in the left panel or go to Project Settings to:&lt;/li&gt;
&lt;li&gt;Rename your project&lt;/li&gt;
&lt;li&gt;Enable or disable Google services&lt;/li&gt;
&lt;li&gt;Manage deployment settings (when building web apps or add-ons)&lt;/li&gt;
&lt;li&gt;View script ID for external use (e.g., clasp or GitHub)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Writing your first script: "Hello World!"&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;If you already code, you would be familiar with the concepts "&lt;strong&gt;functions&lt;/strong&gt;" and "&lt;strong&gt;logs&lt;/strong&gt;." &lt;strong&gt;Functions&lt;/strong&gt; are reusable blocks of code that help perform a specific task. They help organize your code by making it easier to read and preventing any forms of redundancy. &lt;br&gt;
This is how you define a function in Google Apps Script (just like in JavaScript):&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;function nameOfFunction() {
  // your code goes here
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;There are certain keywords to note here:&lt;br&gt;
&lt;code&gt;_function_&lt;/code&gt;: keyword to define a function&lt;/p&gt;

&lt;p&gt;&lt;code&gt;_myFunction_&lt;/code&gt;: name of the function (you can name it anything, but myFunction is the default).&lt;/p&gt;

&lt;p&gt;Logs, on the other hand, help to keep track of events that occur when your code is compiling. It is useful for debugging or checking output. Just like the &lt;code&gt;console.log&lt;/code&gt; in JavaScript, &lt;code&gt;Logger.log()&lt;/code&gt; is used in Google Apps Script.&lt;/p&gt;

&lt;p&gt;Let’s walk through creating and running your very first Google Apps Script.&lt;br&gt;
After opening your Apps Script Editor, delete any default code and paste the following:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;function myFirstFunction() {
  Logger.log("Hello, world!");
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;At the top of the editor, make sure myFunction is selected in the dropdown.&lt;/li&gt;
&lt;li&gt;Click the Run ▶️ button.&lt;/li&gt;
&lt;li&gt;&lt;p&gt;The first time you run a script, Google will ask for permission. Follow the prompts and authorize the script.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;To see what your script logged:&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Click View &amp;gt; Logs&lt;br&gt;
or&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Use the left sidebar and go to Executions → click on your latest execution → view the logs.&lt;br&gt;
&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;[20xx-xx-xx xx:xx:xx] Hello, world!

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;With this, you have written your very first Google Apps Script!&lt;/p&gt;

&lt;p&gt;I hope you were also able to follow along and practice. In our next tutorial, we will be learning how to use some basic Javascript concepts while building our very first automation script with Google Forms.&lt;/p&gt;

&lt;p&gt;See you next time!&lt;/p&gt;

</description>
      <category>tutorial</category>
      <category>beginners</category>
    </item>
  </channel>
</rss>
