I always tell people interested in IT that information technology itself does nothing on its own. It’s simply a tool—one that moves information from left to right and back again. IT becomes truly exciting when we combine this tool with any other discipline. If you love geography, then geoinformatics, GIS systems and mapping might be your world. If you’re interested in medicine or healthcare, bioinformatics and telemedicine systems are worth exploring. If sports is your thing, wearable technologies are a great direction. If communication is everything to you, learn about the internet, networks, and mobile technologies. If you enjoy creating something new from existing pieces, then data mining or big data will be your playground. If your passion is art, then image algorithms, film effects, and prototyping boards give you endless possibilities. And this is only the surface.

This diversity is well reflected in Ponte’s projects. Our Smartcity mobile app includes several geoinformatics features such as routing, map rendering, and AR. We have also completed R&D projects like Beacon-based indoor positioning. Our DOKK CMS system runs 24/7 at financial partners such as the Budapest Stock Exchange or Diákhitel. In earlier years, we built video distribution and streaming solutions, and now we are working on cryptocurrency projects.

Wherever information appears, software development becomes relevant immediately. This is why IT is so widespread and continues to bring surprises. The IT sector is hungry for developers, as countless ideas still wait to be implemented. In business terms, not implementing a project can mean losing measurable potential revenue. This is why the phrase “time to market” is repeated so often.

What can a company do when it cannot find enough workforce?

Automation! Automation! Automation!

Engineers and developers are trained to solve problems. It’s no exaggeration to say they dislike monotonous tasks and administration, and if something must be done more than 20 times, they’ll write a script for it. This is what you must use to your advantage! Why not write software to support company operations and eliminate repetitive tasks? Think about Industry 4.0—robotization is conquering new fields. Self-checkout machines now exist in most supermarkets, and Amazon is experimenting with a store where you can just walk out with your products. Or consider grocery delivery services. If they can change their mindset and processes, why shouldn’t you?

syoc_-_gsuite-products.png

Let’s move beyond the fact that Google offers many browser-friendly office tools like Docs, Spreadsheet, Slide, Forms, Calendar and Gmail. Even G-Suite calls them only Core products. Besides these, there are over 55 more Google services—and many more in the Marketplace.

But imagine being able to create any connection between them, following any set of rules! What would you change to make your company operate more efficiently?

 

syoc_-_power-of-g-suite.png

 

And this is where Google Apps Script comes in.

You work in HR. Twice a year you must anonymously gather feedback about issues related to the office. Then you must compile an Excel (Spreadsheet), create charts, and send them to management.

You work in HR. Every colleague with a birthday receives a friendly greeting email in the morning—even if you’re on vacation.

It’s procurement season. You must once again gather internal requests, prepare a spreadsheet, produce a decision prep, and prioritize items.

You are a PM. A new project starts. Once again you must create a Drive folder structure, set permissions, create a Google Groups mailing list, a YouTrack or Jira board with the same agile states, a Slack channel, and invite everyone.

You are a CFO. Every time an (automated) invoice arrives via email, you download the PDF and upload it to Drive under the current month!

You are a CEO. You have no time. But you must stay up-to-date on progress, resource usage, and what’s happening with the team. You’d like a summary.

You are a sysadmin and learn that Drive offers unlimited storage. You want to use it for backups. Then you realize how many new possibilities this gives you—everything is in one place, so you can monitor and test backups easily.

You are a PO and twice a year you must show how the product is performing through numbers in a short presentation. The same products, the same metrics, the same report.

You are a Growth Hacking wizard. You help the Sales team in real estate. You come up with the idea that prospective buyers could receive a personalized presentation attached to an email based on their Form submission—something they can save to their phone and access offline. No need to constantly update how many properties are still available, or what the current mortgage offers are, and so on.

If I say Contacts, Calendar, Maps, Gmail, Translate—what could you build out of these? A multilingual meeting room booking system? Or an always up-to-date customer map?

Let’s raise the bar. What if you could score your customers and see how difficult they are? Gmail analysis could show the administrative overhead they create. Using Maps or the Directions API, you could calculate the average travel time to customer sites. Or count related documents on Drive. When renewing a contract, you could immediately include these costs.

I think this is enough to understand the potential of G.A.S.

Let’s look at what you need to know about Google Apps Script!

You get a scripting language based on JavaScript 1.6, extended with several features from versions 1.7 and 1.8, along with a subset of the ECMAScript 5 API. It includes a browser-based code editor with debugging tools. The logic you write runs on Google’s servers—no installation required.

It can be used for several purposes; here are some key categories:

  • Web app: an independent web application that works like a full product
  • Extension: custom menus, dialogs, sidebars that extend Docs, Spreadsheets, or even Forms
  • Add-on: new G-Suite office tools published in the G-Suite Add-on Marketplace

There are more possibilities as well, such as writing scripts for Spreadsheets similar to MS Office VB scripts. Or building a chatbot with Google Apps Script, which has become increasingly popular due to reducing customer service load.

Google Apps Script basics

Let’s create our first app and look at the essential concepts!

We can do this in two ways:

  1. Go to script.google.com, where you can see all your existing scripts. Click +New Script in the top left corner.
    syoc_-_gas-create-v2.jpg

  2. In Google Drive, navigate to the desired folder and choose +New > More > Google Apps Script
    syoc_-_gas-create.jpg


If done correctly, the online editor opens immediately and you can start working.

How a script file is structured

Apps Script is complex and consists of multiple parts. There are the script files (*.gs), which we will primarily focus on, but also timed triggers and library usage.

syoc_-_gas_empty.jpg

You’ll notice that a Code.gs file is created by default (see left), containing a myFunction() method. You can start writing your JavaScript code right away. It’s good to know you can add more *.gs files to improve structure in larger scripts.

syoc_-_gas-add-new-gs.jpg

You may also notice that HTML files can be added—these will be useful when creating frontend interfaces. :)

The execution order of code depends on the order of the created files. :( This is a limitation, but we can avoid issues with some planning. Based on experience, create the following *.gs files before starting:
- Polyfills.gs: if some JS feature is missing from the current engine, substitute it with a polyfill. Ideally, this file stays empty—but that causes no issues.
- Configs.gs: parameters affecting script behavior.
- Tools.gs: helper functions and classes.
- Triggers.gs: time-based functions. Optional.
- Apps.gs: the high-level application logic.
…and then the frontend HTML files.

 

Hello world

Let’s start with a simple hello world application.

syoc_-_gas-hello-world.jpg

You can run the script using the ▶ button in the menu. First choose which function to run—in this example, helloWorld. Apps Script does not have a main() entry point in the classical sense.

Only saved code will run. If there are unsaved changes, they are indicated with a red asterisk on the tab. Press Ctrl+S before running.

Logging

When you run the script, it might seem like nothing happens. This is because the Log panel is not visible. Open it via View > Logs or press Ctrl+Enter.

Debugging

One last essential tool: debugging. Even though the code runs in the cloud while you write it in a browser, everything works as you would expect from a normal development environment.

syoc_-_gas-hello-world-debug.jpeg

Set a breakpoint, then run in debug mode using the bug icon. You’ll see a watcher panel that lets you follow the execution step-by-step and inspect partial results along the way.

 

I believe this is enough for an introduction and to understand the basics. If you’re excited to see more code, I recommend reading the next chapter—or explore the official guide.