Data processing just got easier with Apps Script’s new V8 runtime
What is Google Apps Script?
As a quick summary, for small to medium-sized team projects, Google offers a free scripting environment that connects Google and non-Google applications to automate calculations or workflows (by visiting script.new in a browser, or Tools > Script editor within a Google Sheet, Doc, Slide, Form, etc., or recording your steps as a macro). Each script (called an Apps Script) can run on a schedule, or be triggered by a user’s actions. These actions can include opening a sheet or interacting with custom UI components such as custom formulas, pop-ups, menu dropdowns, or even complex HTML-based interfaces with buttons and text inputs (web apps).
Four improved use cases
In computer history, one can compare the revolutionary practicality of the industrial period’s assembly line with that of assembly language. The sequential list of instructions (for-loops, while-loops, if-statements), called imperative programming, served as a recipe-like format, but it doesn’t have room for abstracting code for humans (in other words, very literal instructions). It also can run into trouble when executing multiple instructions using the same memory; if there are “too many cooks in the kitchen,” unintended interpretations produce alternate outcomes (or side effects).
By leveraging modern JS, one can lean on functional programming, which bases its logic in evaluating statements as mathematical functions. This way, each function has its own purpose, which reduces hidden dependencies; allows parallelization without tasks “stepping on each other’s toes;” and locks memory to ensure there are no overwrites.
Modern JS’s explicit expressions reduce complexity, making it easier to write and maintain (read) scripts. Two of many favorites are:
Arrow functions: a function is passed as an argument to another function as data, in one line, using an arrow icon =>
Spread operator: inserts the values of an array using 3 dots
I recommend two great resources by Google Developer Experts (GDEs):
A summary of JS features with examples by Ben Collins.
A list of free JS learning sites by Amit Agarwal.
Data processing operations
Whether it’s physics simulations, invoice trends, ETL (extract, transform, load), or linear regression-based processes, using “map,” “filter,”, and “reduce”with arrow functions is powerful and clear. The runtime also provides a faster CPU computation for such mathematically intensive activities, and a betterlogs experience.
The best of JS features, combined with Apps Script
If you’re using scripts that employ the older runtime, review these incompatibility tips—unless you wish to opt out from migrating to the new version. It’s exciting to see what the community can build with the new capabilities modern JS unlocks, especially those who work with Google Sheets and data processing use cases.
Related Google News:
- Add and manage four new types of citations in Google Docs March 31, 2021
- Creating an Experience Management (XM) Data Warehouse with Survey Responses March 31, 2021
- Say "Hey Google..." to the new Fiat 500 Family March 31, 2021
- Sleeping on the job: How we built the new Nest Hub March 30, 2021
- Redefining what a map can be with new information and AI March 30, 2021
- Albertsons and Google are making grocery shopping easier with cloud technology March 30, 2021
- How sweet it is: Using Cloud AI to whip up new treats with Mars Maltesers March 30, 2021
- Data Lake management just got easier with Dataproc Metastore GA March 29, 2021