Automate everything with Apps Script

The best way to bring back some sunshine to your life is to get rid of the boring tasks. How to do that? By automating everything! During the next few paragraphs I will guide you through the basics, use cases and how to start using machines to do your dirty work.

What is Apps Script?

Apps script is a coding environment by Google that facilitates coding and connecting services like Spreadsheets, Docs, Slides and others. The full list is available in the developer documentation.

The best thing about Apps Script is that you code in JavaScript which is the language of the web. Above all, it’s extremely easy to get started.

How to code in Apps Script?

Apps script as mentioned above is vanilla JavaScript. To start your adventure with automating your boring tasks you need a basic level coding.

Top 5 reasons why you should know Javascript as a Digital Marketer

Of course the number one reason to learn coding is to create your own Artificial Intelligence that will conquer the world, but there are also some other reasons.

  1. Create what you imagined – For me this is the number one reason. I often think how can I make this simpler and how can I make this better. Automation with JavaScript gives me the possibility to do this. I am not a professional programmer, but I have enough knowledge to figure things out and make it work. This freedom of expression is for me extremely important.
  2. JavaScript is the language of the web – It’s present everywhere. On every website. The internet has gone from hating JavaScript for being inaccurate to hating JavaScript for being everywhere. And now, it’s not even limited to the browser. With the rise of NodeJS it can now run on the back-end. For us, digital marketers, every pixel, tag, dataLayer is based on JavaScript. We must know at least the basics.
  3. Limit developer involvement and speed up implementation – For a lot of companies this a real problem. Devs are stretched to the limit. Priorities change daily. Backlog gets fatter by the minute. Marketing tasks get pushed back to the very end. Unfortunately this is our reality. I have worked with a client that was implementing the enhanced eCommerce dataLayer schema for 6 months. Not joking. If you do even a part of the implementation yourself it will help.
  4. Know limitations and understand technology – It’s very important to understand the basic limitations. For example:
    • Why variables can be undefined
    • How async works
    • How JS can impact website performance

Apps Scripts New Coding UI Overview

New Apps Script UI
  1. List of all the files in your Apps Script Project
  2. You can reuse code that you have previouslu written by using them as libraries
  3. Click to enable additional services in your project like GMail, Google Analytics or others.
  4. The execute button.
  5. You can choose the function you want to run from the dropdown menu
  6. Execution log to preview the result.
  7. If you want to get access to your app or to use it as an API you can deploy it to the public.

Apps Script Examples and Use Cases

There is a lot of potential uses for Apps Script automation. Let me list some of the simple ones:

  • sending automated email reminders – this is a great case for automating and letting the robots take care of everything.
  • listing all of the sheets in a spreadsheet – have you ever worked on a spreadsheet that constantly gets bigger and you loose control over the files. You can write a script that creates an index sheet and refreshes it on every open of the file
  • retrieve the pages from sitemap.xml – this is a great idea for SEO.. When you need to get a list of all the pages from the website into a spreadsheet using a script makes it easy.
  • get data from and API – if you need to retrieve data from an API the best way to do it is using a script. For example you sales data, marketing data or similar.
  • sending emails with reports – do you have a report set up that you would love to share with your colleagues on a regular basis? Apps scripts is the way to go. You can send email with a PDF report attached just by writing a few lines of code.

Where to get started with coding in Apps Scripts

There is a lot of places where you can learn Apps Scripts. I would like to recommend the ones listed below:

Useful Tips and Tricks

  • Dark mode – to enable Apps Script dark mode please press F1 and select “Toggle High Contrast Theme”
  • You can color your console logs with different colors
    • console.log();
    • console.warn();
    • console.error();

Let’s bring this one home

Apps script is a power house. With functions ranging from fetching data from external APIs, through connecting with Google Services like Youtube or Google Analytics, to sending reports via email the possibilities are endless. Sometimes you will feel frustrated, sometimes you will code for hours at a time, my advise is – just enjoy the journey 🙂 .


Leave a Comment

Your email address will not be published. Required fields are marked *