Google Apps Script Tutorial
Google Apps Script is a coding platform and scripting language in Google Workspace that lets you build simple applications on top of apps like Sheets, Docs and Slides.
The tutorials below will help you learn Google Apps Script, learn how to use it to automate your tasks in and even build simple user interfaces and applications in Google Sheets.
If you're a beginner and you're new to Apps Script, I've written a series of tutorials on learning how to code using Google Sheets and Apps Script. These tutorials start from scratch and do not require you to have any background knowledge of Apps Script or coding. Also, unlike other programming languages, you do not need to install any software to get started. All you need to get started is a Google Sheets spreadsheet.
The thing I like most about Apps Script is that you can immediately apply the concepts you learn to solve problems that you might be facing at work, in school or even in your personal life. In fact, that is the primary reason why I started this blog. I wanted to share my enthusiasm for Google Sheets and Apps Script with the world. Hope you find these tutorials helpful.
Table of contentsBuild user interfaces in Google Sheets using Google Apps Script
Automate Google Sheets and Google Workspace using Google Apps Script
Google Apps Script tutorial for beginners
Build user interfaces in Google Sheets using Google Apps Script
Automate Google Sheets and Google Workspace using Google Apps Script
A series of tutorials to help you get started with Apps Script. If you're new to coding, please also check out the next section on learning how to code using Google Sheets and Google Apps Script.
What is Google Apps Script? — Apps Script is a coding platform in Google Workspace that can be used to build simple applications on top of existing apps such as Sheets, Docs, Forms, etc.
Creating your first Apps Script — Learn how to create your first Apps Script.
Authorizing an Apps Script — Learn how to authorize an Apps Script and the security and privacy considerations to keep in mind while doing so.
Custom functions for Google Sheets using Apps Script — Learn how to write a custom function for Google Sheets using Apps Script.
Google Apps Script editor keyboard shortcuts 😎 — A comprehensive list of keyboard shortcuts for the Google Apps Script editor to help you become more productive while using it.
5+ ways to run Google Apps Scripts in Google Sheets — Learn about several ways to run Google Apps Scripts in Google Sheets and when to use each method.
Learn to code using Google Sheets and Google Apps Script
If you're new to coding, don't worry, Apps Script is easy to learn and use. The best part is that you can learn by doing and immediately apply the concepts you learn to solve real problems. If you've taken coding classes online or at school, you probably found them to be boring and impractical (When was the last time you needed Fibonacci numbers in everyday life?).
In my personal experience, Apps Script is the only coding platform and language that felt refreshingly practical and immediately useful in my day-to-day life. Just a few days ago, a script that I wrote several years ago reminded me about a family member's birthday. It just took me an hour to create the script but it has saved me from embarrassment several times over the past few years!
I've written a series of tutorials on learning how to code using Google Sheets and Google Apps Script. You won't learn every single coding concept but you'll learn enough to build simple applications.
What is Apps Script? — Apps Script is a coding platform in Google Workspace that can be used to build simple applications on top of existing apps such as Sheets, Docs, Forms, etc.
Creating your first Apps Script — Learn how to create your first Apps Script.
Custom functions for Google Sheets using Apps Script — Learn how to write a custom function for Google Sheets using Apps Script.
How to return an error from a custom function? — Learn how to use the throw statement to inform users that an error has occurred in a custom function.
How to pass cell coordinates to a custom function? — Learn how to make your custom function know which cell it is being run from.
Enable autocomplete for custom functions in Google Sheets using JSDoc — Learn how to enable autocomplete for your custom functions when you use them within formulas in Google Sheets.
Values, types and operators in Apps Script — Values are the data used by your program. There are six types of values in Apps Script. Operators are used to perform operations on values.
Strings in Apps Script — Strings are text values and you'll use them a lot while programming. This tutorial covers the basics of working with strings in Google Apps Script.
Conditional logic in Apps Script — Learn how to use IF-ELSE statements in your Apps Script code to implement conditional logic.
Variables and constants in Apps Script — Variables are used to store values. Constants are just like variables except you cannot change their value after assignment.
Objects in Apps Script — Objects are used to organize the values in your Apps Script program that are related to one another.
Arrays in Apps Script — An array is a special type of object that is used to store a list of values. You will use arrays extensively while working with Google Sheets using Apps Script.
Array methods in Apps Script
The Array method join() in Apps Script — The Array method join() concatenates the values in an array into a single string.
The Array method reverse() in Apps Script — The Array method reverse() reverses the order of elements in an array.
The Array method sort() in Apps Script — The Array method sort() sorts the elements in an array.
The Array method push() in Apps Script — The Array method push() adds elements to the end of an array.
The Array method pop() in Apps Script — The Array method pop() removes an element from the end of an array.
The Array method shift() in Apps Script — The Array method shift() removes an element from the beginning of an array.
The Array method unshift() in Apps Script — The Array method unshift() adds elements to the beginning of an array.
The Array method splice() in Apps Script — The Array method splice() is used to change an array by removing elements from it and/or adding elements to it.
The Array method concat() in Apps Script — The Array method concat() merges two or more arrays into a single array.
The forEach() loop in Apps Script — The Array method forEach() is used to execute a function for every element in an array. It is also referred to as the forEach loop.
The Array method indexOf() in Apps Script — The Array method indexOf() is used to find if a value is present in an array. It returns the index where the element is found or -1 if it is not found in the array.
The Array method every() in Apps Script — The Array method every() is used to check if every value in an array meets a set of conditions.
The Array method filter() in Apps Script — The Array method filter() is used to filter an array based on a set of conditions.
The Array method some() in Apps Script — The Array method some() is used to check if at least one element in the array meets a set of conditions.
The Array methods reduce() and reduceRight() in Apps Script — The Array methods reduce() and reduceRight() reduce the values in an array to a single value.
The Array method map() in Apps Script — The Array method map() creates a new array whose values are obtained by calling a function on each element of the original array.
Loops in Apps Script — A loop is a piece of code that runs a set of statements multiple times. Each run is called an iteration. There are two common types of loops in Apps Script: For and While.
Comments in Apps Script — Add comments to your code to help others understand what your code does.
Build user interfaces in Google Sheets using Google Apps Script
Learn how to build custom user interfaces like alerts, prompts, sidebars, etc. in Google Sheets using Google Apps Script.
Custom menus in Google Sheets — Custom menus in Google Sheets make it easy for end users to access the functionality that you've developed using Google Apps Script. Learn how to create custom menus in Google Sheets.
Navigation menu in Google Sheets — Build a navigation menu in Google Sheets to make it easy for users to find and open the right sheet.
Displaying notifications in Google Sheets using toasts — A toast is a notification that provides some contextual information to the user in an unobtrusive manner. Learn how to display toast notifications in Google Sheets using Google Apps Script.
Pop up alert messages in Google Sheets — A pop up alert message is used to display important information that the user must pay attention to. Learn how to display pop up alert messages in Google Sheets using Google Apps Script.
Getting user input in Google Sheets using prompts — Learn how to use prompts to get user input in Google Sheets.
Buttons in Google Sheets — Learn how to create clickable buttons in Google Sheets using Google Apps Script.
Radio buttons in Google Sheets using Apps Script — Learn how to build radio-button-like functionality in Google Sheets using Google Apps Script.
Custom sidebar in Google Sheets — A custom sidebar can be used to build your own user interfaces (such as data entry forms) within Google Sheets.
Custom dialog in Google Sheets — A custom dialog can be used to build custom prompts, alerts or other dialogs in Google Sheets.
Automate Google Sheets and Google Workspace using Google Apps Script
You can automate your tasks in Google Sheets or other Google Workspace apps using Apps Script. You can even build simple applications with just a couple of lines of code. I truly believe that knowing Apps Script is like having super power and it is not even that hard to learn.
One of the most common use cases of Apps Script is automating repetitive tasks in Google Sheets. The next time you notice yourself doing the same multiple times, consider writing a script to automate it instead! You'll be surprised how easy it is to automate Google Workspace.
Here are some examples of applications that you can build using Google Sheets and Apps Script:
Automate Google Sheets using Macros — A macro is a simple way to automate repetitive tasks in Google Sheets. Using a macro, you can record a set of actions and then reuse them in the future with just a single click.
Triggers in Google Sheets — Triggers enable you to automate your tasks and workflows in Google Sheets. In this article, you'll learn more about triggers, how they work and how to create them.
Create triggers programmatically using Apps Script — Creating triggers using the Apps Script editor UI can be inefficient if you're creating many triggers. Learn how to use Apps Script to programmatically create triggers!
Birthday reminders using Google Sheets 🎂 — Learn how to use Google Sheets and email reminders to remember birthdays.
Expense approval workflow using Google Forms and Apps Script — Learn how to build a simple expense report approval workflow using Google Forms, Google Sheets and Google Apps Script.
Streamline data entry by embedding Google Forms in Google Sheets — Streamline data entry and minimize data entry errors by embedding a Google Form in a Google Sheets spreadsheet using Google Apps Script.
How to automatically sort Google Form responses — Learn how to automatically sort your Google Form's responses so you'll always see the most recent ones at the top.
Email notes to yourself from your phone using Google Sheets 📔 — Learn how to build a simple app to email notes to yourself from your phone using Google Sheets, Google Forms and Google Apps Script.
How to import CSV files into Google Sheets using Apps Script — Learn how to automatically import CSV files from a URL or from Google Drive into Google Sheets using Apps Script.
Star rating system in Google Sheets ★★★★★ — Learn how to build a 5-star rating system in Google Sheets using a custom function written with Google Apps Script.
Tracking your mood using Google Sheets — Learn how to build a simple mood tracking app using Google Sheets.
Working with Google Slides using Apps Script
Generate Google Slides from Google Sheets 😎 — Automatically generate Google Slides presentations using data from a Google Sheets spreadsheet.
Create a copy of a Google Slides presentation using Apps Script — Learn two ways to create a copy of a Google Slides presentation using Apps Script.
Center images in Google Slides using Apps Script — Learn how to use Apps Script to center images in a Google Slides presentation.
Merge images in Google Slides using Apps Script — Learn how to programmatically insert images into a Google Slides presentation using Apps Script.
Mail Merge from Google Sheets to Google Slides — Learn how to create personalized student certificates by mail merging data from Google Sheets into a Google Slides template.
Convert each row in Google Sheets into a slide in Google Slides using Apps Script — Learn how to use Apps Script to create a slide in a Google Slides presentation for every row in a Google Sheets spreadsheet.
Create Google Docs from Google Sheets using Apps Script — Learn how to automate parts of your content creation workflow using Apps Script.
Export a list of your files in Google Drive to Google Sheets using Apps Script — In this tutorial, I'll show you how to export a list of your Drive files to a Google Sheets spreadsheet using Apps Script.
Motivational quotes to start your day using Google Sheets and Apps Script — Learn how to use Google Sheets and Apps Script to receive an email every morning with a motivational quote.
Comprehensive guide 📓: Export Google Sheets as PDF, Excel, CSV, or other formats using Apps Script — A comprehensive guide on converting Google Sheets to PDF, Excel, CSV, TSV, ODS or HTML using Apps Script.
Automatically convert Excel spreadsheets to Google Sheets using Apps Script — Learn how to convert Excel to Google Sheets using Apps Script and then import data from the converted spreadsheet into a master Google Sheets spreadsheet!
Email notifications for Google Forms — Learn how to send email notifications whenever a Google Form is submitted and also include the contents of the submission in the notification itself.
Sending email from Google Sheets
Most business use cases involve sending emails. These range from emailing invoices to customers using Mail Merge, automatically sending weekly reports to leadership or sending automated reminders to keep projects on track. It is really easy to send emails from Google Sheets and I've written several tutorials on this topic covering many of the important use cases.
Sending email from Google Sheets using Google Apps Script — A comprehensive guide to sending email from Google Sheets using Google Apps script.
Automatically email a Google Sheet as a PDF attachment — In this post, I'll teach you how to automatically email a Google Sheet as a PDF attachment from within Google sheets itself.
Send email from Google Sheets based on a schedule — If you've worked in any organization of any size, you've probably had to put together and send reports on a regular basis to your team. In this post, I'll show you how to automate sending emails from Google Sheets based on a schedule.
Send an email for every row in a Google Sheet — This tutorial will teach you how to send an email for every row in a Google Sheet.
Mail Merge in Google Sheets — Learn how to send personalized emails from Google Sheets using Mail Merge.
Send HTML email from Google Sheets — Learn how to send HTML email from Google Sheets using Apps Script. I'll also show you how to create the HTML email template using Gmail and Google Docs.
Send email when a Google Sheet is edited — Learn how to automatically send email notifications whenever your Google Sheets spreadsheet is edited.
Build games in Google Sheets using Google Apps Script
Working with Google Sheets doesn't always have to be about crunching numbers or automation! You can also build games on top of it. The fact that you can easily store data (it is a spreadsheet afterall), build custom user interfaces and write custom code means that you can use the spreadsheet as a canvas for building games.
Build a guessing game in Google Sheets — Learn how to build a guessing game in Google Sheets using Apps Script.
Tic Tac Toe in Google Sheets 🎮 — Learn how to build Tic Tac Toe in Google Sheets using Apps Script.
Google Sheets Apps Script Examples
Tutorials covering a range of topics related to working with Google Sheets using Google Apps Script.
Activate a sheet in Google Sheets using Google Apps Script — Learn how to programmatically activate a sheet using Apps Script.
Iterate through rows in Google Sheets using Apps Script — Learn how to iterate through rows in a Google Sheets spreadsheet using Google Apps Script and take some action on each row.
Iterate through every cell in a range in Google Sheets using Apps Script — Learn how to iterate through every cell in a range in Google Sheets using Apps Script
Automatically resize rows & columns in Google Sheets using Apps Script — Tired of manually resizing rows and columns in Google Sheets? Learn how to automate this using Apps Script!
Automate inserting charts in Google Sheets using Macros — Instead of inserting charts manually, you can use Macros to automate this process.
Create a new sheet for each row in a Google Sheets spreadsheet using Apps Script — Learn how to create a new sheet for each row in a Google Sheets spreadsheet using Apps Script.
Create triggers programmatically using Apps Script — Creating triggers using the Apps Script editor UI can be inefficient if you're creating many triggers. Learn how to use Apps Script to programmatically create triggers!
Add links to a cell in Google Sheets using Apps Script — Learn how to add links to a cell in Google Sheets using Apps Script.
Freeze rows and columns in Google Sheets using Apps Script — Learn how to freeze rows and columns in Google Sheets using Apps Script.
Write multiple rows of data to Google Sheets using Apps Script — Learn how to efficiently write multiple rows of data to a Google Sheets spreadsheet using Apps Script.
How to convert strings to Proper case in Apps Script? — In this tutorial, you'll learn how to write a custom function to convert a string to Proper case in Google Apps Script.
How to get the Hexadecimal codes of colors in Google Sheets — Learn how to write a custom function to get the HTML color code (also known as a Hex code) of a cell's background color.
Reading from and writing to a Range in Google Sheets using Apps Script — This tutorial will walk you through several ways to read data from and write data to your Google Sheets spreadsheet using Google Apps Script.
Working with Checkboxes in Google Sheets using Google Apps Script ☑️ — Learn how to insert, remove and work with checkboxes in Google Sheets using Google Apps Script.
Get started with running JavaScript in Google Sheets — This tutorial will show you how to run JavaScript code in Google Sheets.
Rename a sheet in Google Sheets using Apps Script — Learn how to rename a sheet in Google Sheets using Apps Script.
Hide or show a sheet in Google Sheets using Apps Script — Learn how to hide a sheet, or show a hidden sheet in Google Sheets using Apps Script.
Clear a Range in Google Sheets using Apps Script — Learn how to clear the contents, formatting, data validations, etc. in a range using Apps Script.
Enter the same value in every cell of a Range in Google Sheets using Apps Script — Did you know there is an easy way to enter the same value in every cell of a Range in Google Sheets using Apps Script?
Automatically detect when the user selects a new Range in Google Sheets — Learn how to use the onSelectionChange() trigger to detect when the user selects a new range in Google Sheets.
Hide rows based on cell value in Google Sheets using Apps Script — In Google Sheets, you can use Apps Script to hide rows where a cell has a specific value.
Insert an image into a cell in Google Sheets using Apps Script — Learn how to insert an image into a cell in Google Sheets using Apps Script.
Get the spreadsheet name, the current sheet's name and the list of sheets in Google Sheets using Apps Script — Learn how to create your own formulas in Google Sheets to get the name of the spreadsheet and the sheets it contains.
Find and replace text in Google Sheets using TextFinder and Apps Script — Learn how to automate the "find and replace" feature in Google Sheets using Apps Script.
Solve the Monty Hall problem using simulation and Google Sheets 🐐🏎️🐐 — Are you going to win a car or a goat? Learn how to use simulation and Google Sheets to solve a world famous problem!
Google Sheets Concepts and Tips
A series of tutorials covering important concepts in Google Sheets that you will come across frequently when working with Apps Script.
Google Sheets Tip: Show Formulas in Google Sheets — Learn how to view all of the formulas in your Google Sheets spreadsheet at once.
Range in Google Sheets — A range represents a single cell or a group of adjacent cells in your spreadsheet. In this tutorial, you'll learn about what ranges are and how to use them.
Reading from and writing to a Range in Google Sheets using Apps Script — This tutorial will walk you through several ways to read data from and write data to your Google Sheets spreadsheet using Google Apps Script.
Named ranges in Google Sheets — This tutorial provides a comprehensive overview of named ranges in Google Sheets and how to use them with Google Apps Script.
Checkboxes in Google Sheets ☑️ — Learn how to make your Google Sheets spreadsheet interactive using checkboxes.
Working with Checkboxes in Google Sheets using Google Apps Script ☑️ — Learn how to insert, remove and work with checkboxes in Google Sheets using Google Apps Script.
How to make a Table in Google Sheets? — Learn how to make a table in Google Sheets that is less error prone and is more effective at conveying information.
Master Google Sheets Automation
I'd appreciate any feedback you can give me regarding this post.
Was it useful? Are there any errors or was something confusing? Would you like me to write a post about a related topic? Any other feedback is also welcome. Thank you so much!