March 1, 2024
3 min read

Google Apps Script 101: Everything you need to know

If you've come from the world of Excel, you may have heard of visual basic scripting - ways to manipulate spreadsheets using code. That's kinda what apps script is, but it does so much more.

Google Apps Script is a cloud-based scripting language for light-weight application development in the Google Workspace platform. It allows users to automate workflows, integrate with external APIs, and extend the functionality of Google Workspace apps like Docs, Sheets, and Forms.

Language Used

Google Apps Script is built on JavaScript - more specifically, server javascript. Basically, it doesn't run in the browser. For the nerds, it runs Google's V8 Runtime.

What does it do?

Apps Script in Google Sheets and Docs: Apps Script can transform Google Sheets and Docs by automating repetitive tasks, integrating with external data, and creating custom functions.

  • Google Sheets: Apps Script can read and write data, create custom spreadsheet functions, and automate data processing. Adding Apps Script to a Google Sheet is achieved by opening the Sheet, going to Extensions > Apps Script, and writing your script in the editor that appears.
  • Google Docs: Similar to Sheets, Apps Script can manipulate text, format documents, and automate content creation. To add Apps Script to Google Docs, the process is analogous: open your document, select Extensions > Apps Script, and begin scripting in the provided editor.

We've used apps script to generate documents, help us create webinars on Google Calendar, and connect to external services like Hubspot to get exports to Sheets from our CRM.

How to Use Apps Script:

  1. Access: Through Google Sheets or Docs, access the script editor via the Extensions menu.
  2. Code: Utilize JavaScript to write your script. Reference Google's Apps Script documentation for specific functionalities.
  3. Run: Execute your script directly within the editor to automate tasks or extend functionality.

Here's a video of our Development Lead, Wiktor, taking you through how you can create a fully functioning chat app in just under 8 minutes.

Practical Example

In Google Sheets: To get a corresponding value in a Google Sheet when there's a match, looping through rows with Apps Script can be used. Here’s a simplified example:

function findCorrespondingValue() {
  var sheet = SpreadsheetApp.getActiveSpreadsheet().getActiveSheet();
  var data = sheet.getDataRange().getValues(); // Get all data in the sheet
  for (var i = 0; i < data.length; i++) {
    if (data[i][0] == "YourSearchCriteria") { // Check if the first column matches your criteria
      return data[i][1]; // Return the corresponding value from the second column

This script loops through each row, checks if the first column matches a given criterion, and returns the corresponding value from the second column.

Learning Resources

To effectively learn Google Apps Script, consider the following:

  • Google's Apps Script Documentation: Offers comprehensive guides and reference materials.
  • Online Courses and Tutorials: Platforms like Coursera, Udemy, and YouTube have various tutorials ranging from beginner to advanced levels.
  • Practice: Hands-on experience by automating tasks in your Google Workspace environment is invaluable.

If you're confused or would like us to make something for you in apps script, or perhaps you're curious about upskilling, we can provide training sessions! Drop your email below 👇

Stay Social

© Cobry Ltd | 0333 789 0102
24 Sandyford Place, Glasgow, Scotland, UK, G3 7NG
167/169 Great Portland Street, 5th Floor, London, W1W 5PF
Privacy Policy

Care for a towel? 👀