Google Apps Script Learn Coding Projects Exercises Resources

Explore how you can get started with Google Apps Script using code to interact with Google Workspace GSuite Apps

Google Apps Script is a coding language based on JavaScript that runs in the cloud. You can do really amazing things with Apps Script, within just a few lines of code. It allows you to supercharge your Google Workspace apps, to save time, and do a lot more. Google Apps Script allows you to interact with the Google Suite of products, and create customized functionality within those products. There is nothing to install, it’s based on JavaScript which makes it easy to get started with, and because of the code syntax being JavaScript there is a massive amount of coding examples and support online.

What you’ll learn

  • Explore how to open up the script editor and write code.
  • How to create projects and open the project to update and edit the code.
  • How to create customized functionality within Google Workspace.
  • How to interact with Google Services using Apps Script.
  • How to bring your Google Workspace to the next level.
  • Expand your Google Workspace knowledge with exercises and challenges.
  • How to deploy a web app – yes a URL that runs frontend code and can be shared to the world.
  • Google Workspace Services Creating a Bound Script that powers up your Workspace.
  • How you can create bound applications that allow you to use the Google Workspace container and create customized interaction within it..
  • What you can do with apps script by creating standalone applications that connect to the Google Workspace and Google Services.
  • Create a WebApp URL Sharing and Deploying Scripts with Google Apps Script.
  • How to do amazing things with Google Apps Script.
  • Create custom Macros adding advanced functions to your Spreadsheet with Google Apps Script.
  • Connect your code to a Google Workspace document..
  • How to get data from your spreadsheet and use it within your code with script.
  • The UI menu and how to add custom functions for users within Spreadsheets.
  • How to interact with Google Workspace services examples of using Classes in workspace services and how to access class methods.

Course Content

  • Quick Getting Started Introduction to Google Apps Script –> 6 lectures • 33min.
  • How to do amazing things with Google Apps Script Power up your Apps Script Code –> 13 lectures • 3hr 53min.
  • Google Workspace Services Docs Calendar Drive Forms Gmail Sheets Slides –> 14 lectures • 5hr 37min.
  • Google Apps Script Coding Examples and Helpful Code Snippets –> 2 lectures • 22min.

Google Apps Script Learn Coding Projects Exercises Resources

Requirements

Google Apps Script is a coding language based on JavaScript that runs in the cloud. You can do really amazing things with Apps Script, within just a few lines of code. It allows you to supercharge your Google Workspace apps, to save time, and do a lot more. Google Apps Script allows you to interact with the Google Suite of products, and create customized functionality within those products. There is nothing to install, it’s based on JavaScript which makes it easy to get started with, and because of the code syntax being JavaScript there is a massive amount of coding examples and support online.

 

  • Included 3 Ebooks loaded with exercises and source code, with coding tips for learning Google Apps Script!
  • Each lesson is designed to demonstrate a particular aspect of Google Apps Script coding, with exercises to challenge you!
  • Lessons and content for the lessons is designed from common questions and coding challenges that students have contacted me about.
  • The possibilities are endless, let your imagination guide you.
  • Many students have expressed how much fun and how exciting it is to write code and have it do so many cool things.
  • This is one of the best ways to learn to code, its easy to start, every line of code can do a lot, its logical and fun to write.
  • Google Apps Script is by far one of the best coding languages to get started with, as it allows you to access the power of all the Google Services that simply work so incredibly well within the script.

If you want to learn Google Apps Script – this course is a must have – bring your coding to the next level or get more familiar with all the amazing things that can be done with Google Apps Script.

Easy to get started with – its online so nothing to download all you need is an internet connect and a Google Account and you can start creating your coding apps.  Its based on JavaScript so there is so many resources and code samples everywhere that you can use.  The only limit is your imagination.  Start coding to day within minutes creating amazing applications that can do A  LOT!!!!  You won’t believe it until you try it.  You can do it all!!!

 

Anyone can get started with it quickly and easily. I guarantee once you start writing some code, and see how easily it can do amazing things it will leave you wanting more.

This course is designed to help anyone get started with code, loaded with coding examples and code snippets you can try. Learn more with a step by step approach which helps demonstrate the power of Google Apps Script with simple examples. Coding examples are designed as starting exercises which can be used to bring your applications to the next level. Each lesson is specifically designed to demonstrate how a particular aspect of Google Apps Script can be used to perform common tasks and functions.

Resources, code examples, links, tips… everything you need in order to start coding and bring your applications to life.

The code presented in this course is designed to demonstrate what is possible with Google Apps Script. There is a lot that can be done and projects in this course are starter projects and exercises to help you learn about Apps Script. I do suggest that as you view the lessons of this course, to try the code alongside the lesson, so that you can see the code in action and test the various functions that will be presented.

You will need a Google Account in order to write Google Apps Script. Google Apps Script can be created directly within a web browser, the IDE for writing the code is online. Code does get saved files within your Google Drive.

A prerequisite to being able to write App Script code is JavaScript. Apps Script code is written in modern JavaScript, in addition there are built in libraries that can be accessed within the Google Workspace products like Sheets, Docs, Gmail, Calendar, Drive and more. There is nothing to install. You can write and edit the code directly in your Browser.

There is a lot that can be done with apps script, including publishing web apps, creating custom functions in Sheets, adding menus and dialogs to Docs, Sheets and Forms, interacting with other Google Services like Maps, Drive, Gmail, Calendar and much much more. You can also build and publish addons to the Google Workspace Marketplace.

Section 1 – How to get started with Google Apps Script

Quick Getting Started Introduction to Google Apps Script – How to write Code in Google Apps Script features of Google Apps Script and resources that you can use in order to write your code.

Includes a quick start set of lessons, to get you started quickly and easily.

  • Explore how to open up the script editor and write code
  • Includes Downloadable PDF guide with source code and resources to get started with Google Apps Script
  • Overview of the Apps Script IDE editor for code
  • How to create projects and open the project to update and edit the code
  • How to automate functions with Triggers and run code within a preset time
  • How to get help and how to run the code
  • Create a WebApp URL Sharing and Deploying Scripts with Google Apps Script
  • What you can do with apps script by creating standalone applications that connect to the Google Workspace and Google Services
  • How you can create bound applications that allow you to use the Google Workspace container and create customized interaction within it.
  • Google Workspace Services Creating a Bound Script that powers up your Workspace
  • How to deploy a web app – yes a URL that runs frontend code and can be shared to the world
  • How to output HTML into a web app
  • How to share you apps script project
  • How to translate a string value into another language in ONE LINE OF CODE !!!!  Select from 100s of languages its easy.

Section 2 – How to do amazing things with Google Apps Script – How to use the power of the workspace services and create useful code to do a lot.

  • Section Source Code Getting Started with Google Apps Script Ebook Download
  • Create custom Macros adding advanced functions to your Spreadsheet with Google Apps Script
  • How Marcos can be used to create apps script – explore what apps script is and how it works within your Google Workspace
  • Connect your code to a Google Workspace document.
  • Spreadsheets and how apps script can be used when bound in a container
  • How to get data from your spreadsheet and use it within your code with script
  • Container vs bound Scripts with helpful tips and resources for coding.
  • How to open existing apps script projects and how to edit projects code
  • How to send emails from your bound spreadsheet apps script code.
  • How to create new files and add them to drive within a bound script.
  • How to use apps script for Creating Files on Drive and tracking data in Sheets
  • How to create a PDF Email from Sheet data and send the email using Sheet data
  • How to setup Bound scripts sheets UI menu with apps script
  • The UI menu and how to add custom functions for users within Spreadsheets
  • How to create Web Apps with Apps Script launch your webapp URL to share
  • Learn more about creating web apps with Google Apps Script Do more with Web Apps
  • How to use your Spreadsheet in a web application connecting with JavaScript to your endpoint and outputting the Sheet data into your web page with Frontend AJAX requests.  HTML CSS JavaScript JSON AJAX – You won’t believe it
  • How to create an Apps Script Web API Endpoint for AJAX connections output Sheet
  • Apps Script Web app Data transfer from ClientSide to ServerSide WebApp Sheet creating web apps and connecting the frontend code to the backend code.  HTML CSS JavaScript within you WEBAPP
  • Automation with Google Apps Script – run while you sleep!
  • Google Apps Script Automation with Triggers Simple Triggers

Section 3 – Google Workspace Services  Docs Calendar Drive Forms Gmail Sheets Slides – How to interact with Google Workspace services examples of using Classes in workspace services and how to access class methods

  • How to use Document Service ​​with Apps Script DocumentApp Class and methods
  • How to setup Form Submission to Sheet spreadsheet data to get responses.
  • Create Forms with Google Apps Script Code Forms Service Creating form
  • How to use Spreadsheet Service SpreadsheetApp with Google Apps Script
  • Apps Script How to use SpreadsheetApp update Sheets data in Spreadsheet
  • Coding using Spreadsheet range selections and updates of Cells with AppsScript
  • How to add Conditional Rules Format with Google Apps Script code
  • Apps Script how to use CalendarApp Class Methods and Calendars in Workspace
  • How to create Apps Script code to access Drive Service DriveApp functions
  • How to select files within a folder, get properties and loop through the Fileiterator object.
  • Create Move Updates Files and Folders within your Google Drive with Code
  • How to update the contents of a file, and change the name
  • How to select an html file or text file and turn it into a PDF that gets emailed
  • Sending Emails Messages Thread updates with GmailApp Gmail Service Functions
  • How to reply to a message and get message info from the GmailMessage object
  • How to add email attachments to your drive with Apps Script.
  • Explore Slides Service with SlidesApp Class with Apps Script code.
  • How to add layouts selecting layouts from the presentation.
  • How to set random background colors to your slides.
  • How to generate images from all the slides in your presentation and save the images to your drive.

Section 4 – Google Apps Script Coding Examples and Helpful Code Snippets – Explore some amazing applications that you can build with google apps Script.

  • Google Sheets Data Exercise sending emails and updating sheet content using UI
  • Common questions and Coding examples
  • Helpful tips and resources with sample code
  • Fun coding projects
  • Video responses to student questions.

Google Apps Script allows you to create custom blocks of code that do stuff, and there is a lot of stuff you can do with it.

Container-bound Scripts – the Google file the Apps Script is attached to is known as the container. Bound scripts behave just like Standalone scripts but they have several special functions, they do not show up in drive and they cannot be detached from their container files. Script can be bound to Sheets, Docs, Slides, or Forms. To reopen the script in the future you can open the container file and select the script editor, or you can go directly to the dashboard. Apps Script home page, and select the project from there. For bound scripts it will show the container file icon, with a small Apps Script logo on it indicating that it is a bound script.

Apps Script Web app Data transfer from ClientSide to ServerSide WebApp Sheet data and more

ClientSide to ServerSide WebApp

Google web apps can run client side code that can easily be used to connect to server side Apps Script functionality. To execute server-side functions from client-side code, use services RUN is an asynchronous client-side JavaScript API available in web app HTML-service pages that can call server-side Apps Script functions.

In this example we will demonstrate how to send data objects from the Apps Script server side into the client side and use the data object within JavaScript. Also how we can send data from the client side input field values to the server side script to then be used to update and append content into a selected spreadsheet.

Google Apps Script Triggers Simple Triggers automation and more

Google Apps Script Triggers for Automation

Triggers allow you to run a function automatically within Apps Script. There are simple triggers that are built in and use custom functions in order to start and invoke the function. Within the event object of each event, the triggered function contains an event object that has information about the context in which the event occurred. Some commonly used simple triggers are onOpen() which runs when the spreadsheet, document, is opened. There is onEdit() that runs when the user changes a value in a spreadsheet. Also for web apps doGet() and doPost() are simple triggers that get invoked when the user visits the web application on either method.

Simple triggers must be in a bound script in order to run the application triggers, they also fire automatically without asking for user permissions. They will not run if the file is opened in read only mode. They are also limited in some services that would require authorization. They cannot run for longer than 30 seconds. Simple triggers are subject to Apps Script trigger quota limits.

Installable triggers provide more flexibility for users, they let Apps Script run a function automatically and can also run services that require authorization. Just like the simple triggers the event object is included in each event, that contains information about the context of the event. Installable triggers always run under the account of the person who created them. Installable triggers are subject to Apps Script trigger quota limits.

Taught by a Google Developer Expert for Workspace ready to help you learn and answer any questions you might have.

In 2019 Laurence Svekis was recognized by Google as a GDE (Google Developer Expert) for Google Workspace. Having a real passion for the amazing things that can be done with Google Apps Script it’s been a real joy to create this project based course, so that others can learn and try Google Apps Script. The contents of this coruse contains many coding exercises to practice and learn more about how to apply Google Apps Script code. Please note that having prior JavaScript coding experience although not required is strongly suggested as Google Apps Script uses the JavaScript code syntax and it renders in the JavaScript engine.

JOIN TODAY and START Coding…. 

The Document Service ​​allows scripts to create, access, and modify Google Docs files. DocumentApp is the parent class for the Documents, which contains properties that can be used to update the styling of elements, methods to create and open the documents. Once you have created a Document you can select the Document as an object and use the Classes to interact with it.  You can create or select an existing document or with a bound script get the active document.  The body is an element representing a document body. First get the body so you can use the contents of the document and interact with it.

How to send an email auto response on form submission, setup custom logging into a sheet of data.   Go to Drive and select to create a new form. Within the form, setup questions to collect an email, and first and last name from the user. In the setting tab of the form you can customize the setting options. Select the response tab, and connect the form to a new spreadsheet by pressing the 3 dots icon. This will create a new spreadsheet where we will write the Apps Script code. In the new spreadsheet select under the extensions tab to open a new Apps Script which will be a bound script to the spreadsheet container.   To setup a trigger use the ScriptApp service and add a new trigger to run a function called added on the form submitted into the sheet.

Create Forms with Google Apps Script Code Forms Service Creating form.  How to create forms with Google Form Service  Forms service allows scripts to create, access, and modify Google Forms.  Forms can be created with code, you can set the parameters, questions and set the type of questions all within the form service using Google Apps Script.   Create a form from scratch, send the form link to an email address. Forms will automatically collect results of the responses directly within the main form file, this can be accessed from your drive once the form is created.

How to use Spreadsheet Service SpreadsheetApp with Google Apps Script. SpreadsheetApp Class and Sheets Service Code examples  The Spreadsheet service allows scripts to create, access, and modify Google Sheets files. You can use sheets to store and hold data for other Apps Script applications. Sheets can serve as a database for data as the content is presented in a table format with rows and columns of cells each containing data.  How to create new sheets checking to see if the sheet exists or not.  Using the spreadsheetApp class you can select all the sheets contained in a spreadsheet. Select and create a sheet if it does not exist. Sheet names must be unique, if you try to create a sheet name within the spreadsheet that already exists you will see an error.  How to select sheet cells and update content within those cells.  Selecting the range can then use the range to get values from cells as well as set values within cells. Use the range methods to make a selection of cells that you want to update. There are several ways to select the range, be careful that the range dimensions match the content dimension for the array so that data can be added into the selected range.  How to add content and create additional content for columns of data.  You can append rows of content, setting the content within an array in Apps Script. Using the LanguageApp you can select to translate strings into other languages. How to remove empty sheets from your spreadsheet  Using getDataRange() you can select the entire available set of data within a sheet. This can then be used to get the values, returning all the values within that selected sheet.

Apps Script How to use SpreadsheetApp update Sheets data in Spreadsheet. How to Update Sheets and Spreadsheet content  and prepend rows to sheets.  There are many methods that can be used within sheets, we can also use JavaScript methods to do a lot of adjustments when creating code.   How to create a new sheet and get the id to use in the sheet selection. Once your sheet is created, you might want to reorder the sheets, create a sheet with a specific name and use that sheet. You can check to see if the sheet exists, add headings if they do not exist. Also using JavaScript methods and custom JavaScript functions that can help check and create content for your sheets.

Coding using Spreadsheet range selections and updates of Cells with AppsScript.  Spreadsheet range selections and updates of Cells.  Selecting the range allows you to update the cells within that selection. A range can be selected as a single cell or a collection of cells. Ranges provide access and can allow you to modify spreadsheet ranges. Ranges can be a single cell in the sheet or a group of adjacent cells within a sheet.  How to select ranges and how to select all content into a default range. Adding a block of formulas to a range of multiple cells.  How to select and update the entire range contents of all the cells within the range.

How to add Conditional Rules Format with Google Apps Script code.  Conditional Rules Format  Conditional rules can be selected, added and updated with Google Apps Script. These are rules that can be applied to content to add visual cell properties to the content. Each conditional format rule may contain a single boolean condition.  Class BooleanCondition can access boolean conditions in ConditionalFormatRules. These are criteria that can be used to evaluate the cell content, and if the value condition equates to true the rule is applied.  More info on Spreadsheet objects.  How to add a conditional rule to a range within your sheet.    How to see the rules and return values contained within the rules condition.   How to clear rules and add new rules    How to update a Conditional Format Rule

Apps Script how to use CalendarApp Class Methods and Calendars in Workspace. CalendarApp Methods for Google Calendar.  CalendarApp allows Apps Script to read and update Google Calendar. Using the Calendar service you will have access to the user’s Google Calendar in addition it can also access additional calendars that the user has permissions for. CalendarApp class can be used to interact with the calendar object update, edit and delete calendar entries and events.  You can add and have multiple calendars within the calendar service for your account. All accounts come with a default calendar which is the email address and name of the user for the Google Account.  How to view all calendars for your account.  How to get events within a date range from the CalendarApp class.  How to select and get event information from a set day.  How to create an event and send invites to guests when creating the event.  The event creation method has advanced options that allow you to send invites, add guests, set a location and description for the event. Select your calendar object.  Set a start and end date, including time if you are not planning an all day event.  The time will adjust depending on the calendar timezone, setting with UTC time will set the event for that timezone and will show in the guests calendars within their own timezone.  Add the options options, like description, location, guests, and whether to send the guests invites.  Invites can only be sent at the time of creating the event.   The description and location can be updated. How to select an existing event by ID and how to get the ID of an event.  Once an event is created you can also update the event, below are some common updates to an event object.

How to create Apps Script code to access Drive Service DriveApp functions.   Apps Script Drive Service DriveApp. Drive service will let scripts create, find, and modify files and folders within the users Google Drive.  The DriveApp class allows scripts to interact with files and folders by allowing the script to create, find, and modify files and folders within Google Drive.  MimeType is an Enum (enumeration) that provides access to MIME-type declarations without typing the strings explicitly.  How to create a folder using DriveApp Class  Set the folder name in the parameters, to add the folder to the root folder of your drive you can use the DriveApp class directly, and if no folder is specified the files and folders get created directly in the main drive folder.  How to select a folder and add new folders into it.  Select the folder, this is most commonly done using the id of the target folder.  To create a folder you need to specify the name of the folder in the createFolder method.  If you want to add it to a specific location, select the folder object using DriveApp class first.  Add editors to the folder using addEditor().  How to loop through a folderIterator object.  You can select the starting point for the folder selection within the folder object, which can be selected using the folder id value.   Select all the editors of the folder, this will return an array object which can use typical array methods including the forEach() to loop through the contents.  Get the email of the editor from the DriveUser object.  Get all the folders from a selected folder.  This returns a folder Iterator object. Using the while loop check if the hasNext() returns true, if it does select the next folder in the list using the next() method.  Output the folder names into the Logger execution log output.  How to create files adding editors to the file that gets created.  Using the createFile and setting a filename and contents will create a file type which cannot be viewed within the browser.  Although still recognized as a file the file type is not set and therefore the file is not able to be opened properly.  Setting a file type with MimeType and file extension in the name .

Create Move Updates Files and Folders within your Google Drive with Code.  How to search for a file with a value that is contained within the file name.  If you know the location of the files and want to retrieve files only that have a file name with a given value as part of the name, you can select all the files and then using the string method check if the file names contain the string value.  How to Search files using string methods.  Select the folder you want to search.   Return all the files within that folder. Loop through the files and check the filename which will be returned as a string value.  Since it’s a string you can use string methods to check if the string includes a value.  Apply a condition depending on the results: update the file with a star or move it to trashed.  How to make copies of files and move files within the drive.  Select the folder you want to search. Get the files as file objects so that you can rename and move the files. Using makeCopy() create a copy of the file, setting a new name and moving it to a target folder.  Move the selected file into a folder by its id location.   ​​file.moveTo(moveFolder). How to update the contents of a file, and change the name.  Select the file folder you want to use to update the containing files.  Add a viewer to the file. Set the name of the file with the extension .html. Set the content of the file as HTML structured content file.setContent(html); Go to the drive location of the file, download it and open the downloaded file in your browser as an html file.  How to get the id of a file.  Select the folder with the files, iterate through the file in order to return all the file ids.  Each file will have a unique id value.  For html and text files you cannot open them directly in the drive so the id is not in the browser as it is with other file types and folders. How to get the file editors array . Having the id of the file you can now directly select the file object.  If you have the name of the file you can search for the file to return it as an object. Return the array of file editors into the Logger.  How to select an html file or text file and turn it into a PDF that gets emailed.  Select the file object, then convert the file into a blob.  Not all file types can be converted easily. Get the email of the active user, or set a value for the email.  Create some html content. Using the MailApp service send an html email, add an attachment with the file as a blob and set it as a mime type of PDF.  How to create and add Sheets and Docs files into a drive.  Using the DocumentApp class, create a file.  Get the id of the file.  Once you have the file as a file object you can then use the moveTo to move the file into another folder by selecting the folder as a folder object.  Using the SpreadsheetApp class, create a sheet file.  Select the id of the file, and get it as a file object using the DriveApp class.  Using the moveTo() and set the argument to the value of the destination folder object.

Sending Emails Messages Thread updates with GmailApp Gmail Service Functions.  Gmail Service GmailApp Class  Gmail Service GmailApp Class. Gmail Service allows the Apps Script to send email, create emails,  manage labels, select messages and threads in addition to other Gmail activities.  The difference between GmailApp and the Mail Service is that the MailApp is a simpler class that only allows the sending of email.   If you only want to send an email use the MailApp class, if you want to interact with content in your Gmail account select the GmailApp.   How to add email attachments to your drive with Apps Script.  Select the thread object that contains messages you want to check for attachments.  Select the messages from the thread, and loop through the messages. Get the attachments from the message, loop through the attachments.  Create blobs from the attachments and then create a file with the blob object.

Explore Slides Service with SlidesApp Class with Apps Script code.  Slides Service with SlidesApp Class  Slides Service within Apps Script allows you to create, access, and modify Google Slides files. The SlidesApp Class can create, edit , update and open Slides Presentations.  Create a slide presentation to use for the following exercises  Add text and insert a shape with text into a new slide  Explore Slides Service with SlidesApp Class with Apps Script code.  How to generate images from all the slides in your presentation and save the images to your drive.  Select the presentation and append a new slide to it.

 

Get Tutorial