What is scripting?

You were supposed to sign up for those coding classes in college. But instead you took the road less traveled by, opted for Poetry 101, and now you’re facing a list of work tasks that could be knocked out with a few lines of code—if only you knew some.

Don’t fret. If you’d rather write in pentameter than Python, here’s where Airtable’s Scripting tools can make all the difference.

What is a script?

A script is simply a set of instructions or commands. They’re carried out by a computer program and tell that program exactly what to do. Scripts handle specific, small (but highly useful) tasks inside programs, like triggering pop-up windows or making chatbots respond correctly to a customer’s input.

What’s the difference between coding and scripting?

The tasks one can accomplish with scripting are generally simpler than those that require coding. When you think of scripting, think of the automations and other repetitive functions inside a program, rather than the program itself.

When someone says they’re learning a scripting language, it likely means they’re tackling something slightly narrower in scope than learning general computer coding languages like C or C++, which are used to architect software programs from scratch.

Somewhat confusingly, JavaScript is both a scripting language and a widely-used programming language. But in general: scripting is a type of coding that has more limited uses.

What does it mean for your daily work?

At work, writing a script can help you take control of your workflow in a way that tidies up those annoying tasks you might otherwise have to perform manually. Maybe you’re working with a long list of customer names or a big sales dataset and need to find and replace something in the list or convert currencies. Such drudgery can be automated by either installing or writing a script.

Let’s say you’re running an events company. In Airtable, your base might include the names of people who would like to attend your events. A base sometimes looks like a spreadsheet but is actually a database, the place where you stash and organize a number of records that you can access and work with later.

Looking through your base you can see that, as potential attendees signed up for events, many of them entered their information twice. Now, in a list of some 5,000 names, you may have dozens of duplicate records.

This is where an Airtable script comes in handy. You can run a pre-built script for de-duplicating records, or design a custom script in a way that scans your specific records and eliminates duplicates in a few seconds. You get to decide what makes it a duplicate, whether that’s a repeated email, a repeated first and last name, or something else.

Help from the big four

Scripts generally perform one of four types of actions in databases.

Those are: create, read, update, and delete, or CRUD—an acronym that started circulating in the 1980s and is still widely used today.

When you “create” using the CRUD approach, you’re simply adding in a bit of code that identifies the object you want to perform an action on. In the case of duplicated records, that object is your Airtable base.

“Read” means you want Airtable to read the information in a base and identify duplicate records. “Update,” in this case, would mean flagging that record as a duplicate. And “delete” might mean you design the script to tell Airtable to delete the record after it’s marked as repeated.

This same set of actions can be modified to carry out a wide variety of tasks in a base.

For example:

  • Determining which records in a list don't satisfy a custom rule
  • Fetching information from an API and writing results for each record into an output field
  • Prompting a user for the name of a new project, then automatically creating the relevant project and task records

How to get started using scripts

You can see our most common examples of scripts here, including scripts for replacing occurrences of text snippets and creating a summary of linked records that can be used in an automation. Even if you don't know CRUD about Java, you can still get started with scripting. We've created a repository of scripts that you can use without a line of code.

In an Airtable base, click the button to “add an app,” and choose Scripting. Once you’re there, you can choose from a list of common scripts, and either “Start from example” or “Start from scratch.”

There are nearly two dozen pre-built scripts in the Airtable Marketplace. When you find one that seems useful, click the "Install" button. You can then choose which base you'd like to install the script on. For even more inspiration, check out this collection of scripts submitted by our users.

For a step-by-step tutorial in scripting, it’s worth your while to dive into this four-part, hands-on series with Airtable Solution Architect Giovanni Briggs and Aron Korenblit, host of Airtable’s weekly livestream Table Talk.

Part 1: The basic building blocks of scripting

Part 2: Learn how to create tasks from a template

Part 3: Run scripts in automations

Part 4: Use APIs in Airtable scripts

Their lessons assume no knowledge of coding or scripting and help you tailor scripts to your specific workflows.

Get an overview of Airtable Scripting here.