Topics → Google Apps Script - Custom Functions in Google Sheets

Includes

187 Tutorials

Google Sheets Apps Script: Automate Your Business with Custom Functions and New Features.

Google Sheets is a powerful tool that can help you organize, analyze, and share data. One of the best things about Sheets is that it allows you to automate repetitive tasks and create custom functions that can help you work more efficiently. Google Sheets Apps Script is the key to unlocking this potential. In this article, we'll explore the features of Apps Script, show you examples of what it can do, and teach you how to get started coding with it.

What is Google Sheets Apps Script?

Google Sheets Apps Script is a scripting language based on JavaScript that allows you to automate tasks, create custom functions, and interact with other Google services such as Drive, Calendar, and Gmail. Apps Script is built into Google Sheets, so you don't need to download or install anything to use it. All you need is a Google account and a spreadsheet.

How does Apps Script work?
Apps Script allows you to write scripts that can interact with your Google Sheets data. You can create custom functions that can be used like built-in functions, add custom menus and dialogs, and even send emails directly from your spreadsheet. The possibilities are endless, and Apps Script makes it easy to automate repetitive tasks and streamline your workflow.

What are the benefits of using Apps Script?
Apps Script can help you work more efficiently and save time by automating repetitive tasks. It allows you to create custom functions that can simplify complex calculations or data analysis. It also allows you to integrate your spreadsheet with other Google services, such as Drive, Calendar, and Gmail. With Apps Script, you can customize your spreadsheet to suit your needs and create new features that are not available in the standard Google Sheets interface.

See Examples of Apps Script
Apps Script can be used for a wide variety of tasks, from simple data formatting to complex data analysis. In this section of Better Sheets you'll be able to see tons of examples of Apps Script.

And not only see them but you'll be able to make a copy into your Google Drive. All Better Sheets members can copy the sheet from the tutorial directly into their Google Drive account.

What Apps Script Can Do

Create custom functions
With Apps Script, you can create custom functions that can be used like built-in functions in Google Sheets. For example, you can create a custom function that calculates the average of a range of cells, or a function that generates random numbers.

Automate repetitive tasks
Apps Script allows you to automate repetitive tasks, such as formatting data or sending emails. For example, you can create a script that automatically sends an email reminder to your team members when a task is due.

Integrate with other Google services
Apps Script allows you to interact with other Google services, such as Drive, Calendar, and Gmail. For example, you can create a script that saves a copy of your spreadsheet to Google Drive or creates a Google Calendar event based on data in your spreadsheet.

Create custom menus and dialogs
Apps Script allows you to create custom menus and dialogs in your spreadsheet. For example, you can create a custom menu that runs a script when a user clicks on it, or a dialog box that allows users to input data.

Learn How to Code with Apps Script

Spreadsheet Automation 101
Spreadsheet Automation 101 is the best way to learn the most in the least amount of time. It's 3 hours of programming jargon explained, Apps Script examples and walkthroughs.

Intro Crash Course
You can get a crash course in Apps Script if you want something fast and fleeting.  Learn to Code in Google Sheets is an intro to scripting. It's 40 minutes and gives you a taste of what's to come.

Advanced AI
And if you're looking for something more advanced, take the Adventures in AI course to see how to code apps script to use AI directly inside your Google Sheet.

All these courses are free for Better Sheets lifetime members. Check out our current prices at BetterSheets.co/pricing and join today.

187Tutorials

How To Format Sheets for Notes

Create sortable notes in Three ways. 
1. By adding the original word over and over again
2. Adding notes all in one cell with CMD + ENTER for new lines
3. Use Apps Script to sort the A column even with groups of rows.

Get Every Editor on Every Google File I Own

Get every editor if you're looking for the sheets and documents you've shared with other people and forgot them! Or just want to get a list of them into a Google Sheet. 

Scrape Google Maps Added Phone and Reviews

Added two helper functions to get Phone numbers and reviews of the Google Maps Results.

How to Move Tab To End Easily with Apps Script

Create an apps script to move active tab to the far right.

Can I get alerted when a tab name is changed?

Find out in this quick experiment if a tab name can be alerted to the owner of the spreadsheet. Great for owners and operators who want to know if someone is changing the sheet.

Built a Cookie Clicker Clone in Google Sheets

Generate Coupon Codes from a Google Sheet - Announcing Coupon Code Maker

You can now generate 100% off unique 1 time use Gumroad Coupon codes from a Google Sheet.
It's $30, available now.
Lifetime members get it for free
https://bettersheets.co/tools/coupon-code-maker

What does Coupon Code Maker do?
Coupon Code Maker is designed for generating coupon codes, particularly useful for sellers on Gumroad. The tool, simplifies the process of creating large quantities of unique, single-use coupon codes.

The tool leverages Google Apps Script for its functionality, indicating a strong reliance on automation and API interactions. It's particularly noted for its ability to generate a high volume of codes quickly and efficiently, which can be exported as CSV files for use on platforms like AppSumo and others. This is important for marketing and selling products effectively on various online marketplaces.

There will be continuous updates to Coupon Code Maker. Get it now for a 1-time payment and you'll get all future upgrades for free.

If you're wondering how to build something like this check out Spreadsheet Automation 101 and Supercharge Your Sheets, two courses available for monthly members and lifetime members alike.

Don't Delete My Formulas

How to prevent someone from deleting your formulas. Beyond protecting your range or sheet.

Weekly Email Sheet as Lead Magnet

Create a fun freebie for selling spreadsheets

VAR vs CONST vs CONSTANT in Apps Script

Level up your variable assignments in this quick video on why there is Var or Const, or a Constant.

Introduction to Google Sheets™ Add-on Course

In this course we'll go step by excruciating step how to take a simple apps script from a bound script to your spreadsheet and turn it into a published Google Sheets add-on available to the public on the Google Workspace Marketplace.

Creating a Custom URL Link for Your Spreadsheet

Create an apps script function that gets the url of your spreadsheet into a cell.
HYPERLINK() CONCAT()

How to Make an AI Integrated Freebie Spreadsheet

IF() ISBLANK()

Build a Job Status Checker API in 15 Minutes

The video tutorial demonstrates how to leverage Google Sheets and Google Apps Script to create a simple API for managing and checking the status of jobs or projects. This is particularly useful for project or product managers who need a straightforward system for tracking job statuses without exposing their entire Google Sheet to external users. The process involves:

  1. Setting up a Google Sheet as a database: The sheet contains job IDs and their corresponding statuses. This setup acts as a backend where job statuses can be updated.
  2. Creating an API with Google Apps Script: By writing a custom script, a doGet function is deployed as a web app. This function allows users to query the Google Sheet by job ID via a URL, returning the job's current status.
  3. Deploying a web app: The script is deployed as a web application, which generates a unique URL. This URL acts as an endpoint for the API, where requests can be sent to check job statuses based on job IDs.
  4. Front-end form for checking job status: A form is created using an online tool (like CARRD) where users can input a job ID. Upon submission, the form sends a request to the API, retrieves the job status from the Google Sheet, and displays it to the user.
  5. Securing data visibility: This method ensures that only the relevant job status information is shared with external users, without revealing the entire content of the Google Sheet.
  6. Integration with other Sheets: The API can also be used in conjunction with other Google Sheets using the IMPORTDATA function, allowing for the automated retrieval of job statuses into other spreadsheets without manual data entry or revealing the original data source.

This approach is valuable for project management, allowing for real-time status checks of various jobs with minimal setup and without the need for complex database systems or advanced coding knowledge.
IF() ISBLANK() IFNA()

Explore Readable Hex Codes

Welcome to the captivating world of Readable Hex Codes! In this video, we dive into the intriguing realm of colors represented by hex codes. You'll witness the magic unfold as we explore the delightful hues of "Coffee," "Decade," and many more. With a click, we'll reveal the true essence of these hex codes and bring them to life on a Google Sheet.

SearchLord: One Sheet to Search Them All

SUBSTITUTE() ENCODEURL() FILTER() IFNA()

Create a Stop Watch in a Google Sheet

We'll create a stop watch from scratch. Including Apps Script. What it will do is when you click a button (a checkbox) in a sheet, the script on every edit will add a start or a stop time, then add another time and calculate the duration.

FILTER Can Save You From Task Overload

If you have a list of tasks and statuses, the FILTER formula will help keep you from the brink of Overload by allowing you see each status in a different tab.

Great if you're assigning work to VAs or you just became overloaded with tasks in your own task management system.

A great alternative to Conditional Formatting as well.

And a sneaky new little Apps Script that saves the day.
FILTER()

NEW TOOL Parse Spintax for Content Spinning

Introductng a new tool from Better Sheets. A free Google Sheets™️ Add-On to parse spin syntax content.

Revolutionize Your Google Sheets writing with Spin Tax Content Spinner! Say Goodbye to Tedious Editing. Get All the Variations You Need. 

  • Spin randomly to get one variation
  • Spin text for all variations
  • Spin text for all variations including duplicates

Spintax is written with pipes separating content you want to randomly select. {Hi|Hello|Hey} would either be Hi, or Hello, or Hey.
SUBSTITUTE()

Spreadsheet Automation 101: Introduction to Pre-course Videos

Learn how to automate spreadsheets with Apps Script. The pre-course videos equip you with the fundamentals of coding before you start.

Think Like a Programmer: Develop The Mindset of an Apps Script Coder

Learn how to think like a programmer and develop a coding mindset with these expert tips from a seasoned Google Sheets programmer. Don't fall for the common, ineffective advice, and instead follow this practical advice, including learning the process, figuring out how to search, and avoiding memorization. With these habits, you'll be on the path to successful coding. 

It's hard to code. It's even harder to learn to code. This is my thought process to help you become resilient enough to learn, and continue to learn to code.

Quickstart Tutorial OpenAI API in Google Sheets

Use the power of OpenAI's GPT-3 inside of Google Sheets. In this quick start tutorial I show you how to take OpenAI's curl commands and change them into Apps Script to use GPT-3 inside of sheets. We write a tweet, we ask questions. And now you can use this power for greater good!

ChatGPT Clone in Google Sheets Part 1

In this tutorial, learn how to create a ChatGPT-like interface using Google Sheets and Apps Script. Record your questions and get answers from OpenAI's GPT-3 API. Follow this step-by-step guide to build your own interactive GPT-3 interface.

  • Style a sheet like ChatGPT. Use the correct colors and interface design.
  • Add new rows to record the questions/prompts.
  • Add rows for the responses, and answers we get from OpenAI API.

Capture Emails from Website Form to a Google Sheet (Without Zapier)

Embed a little HTML into your site to capture Emails straight to a Google Sheet. I've written the apps script and the html and the javascript for you. As easy as copy and pasting. Use my referral link if you choose to use Carrd for this: https://try.carrd.co/kamphey
SUBSTITUTE()

Bjarne Asks: Can I show the Last Time of the Last Edit in a sheet?

ow do I show the date and time for the last time something was changed in a sheet? So what's interesting is that this This shows you Google Sheets shows an version history up here and shows you the last edit, but sometimes we want to have that data available to us inside of the sheet.
NOW()

OpenSea Data Inside Sheets

Get floor prices into your spreadsheet with URLFETCHAPP. Accessing OpenSea's API directly from google sheets. Get any data you want. from Market Cap to One Hour Volume

Manage Your Wedding Guest List in Google Sheets

Learn how to manage any event with RSVPs and multiple organizers. Use Google Forms pre-filled links, and interesting formulas to manage the catering automatically. And we write Apps Script to send email to non-rsvp'ed guests.
COUNTA() COUNTIF() FILTER() IFERROR() MATCH() +1 more

Google Sheets Stories? No! But we'll add timestamped video notes to your google sheets.

There was a stories craze. Every app/platform/business was adding 24 hour lasting videos to their users accounts. Now you can do that with Google sheets.
IMAGE() INDEX() SPLIT() ISBLANK() IF() +1 more

Move Entire Row when a Cell is changed to "Yes" - The $75,000 Google Script

This is one of the most popular asked first "automations". How to move a row of data based on a single criteria in a column. Great for sales teams and maintaining a CRM.

5 Ways to Create Coupon Codes | Create UUIDs

Generate Coupon Codes with 5 Levels of Difficulty - From Copy-Pasting to Advanced Google Sheets Formulas. Get up to thousands of unique codes easily! Watch now for coupon mastery inside of Google Sheets.
RANDBETWEEN() DEC2HEX() CHAR() MID()