Airscript Learn to use Airtable scripts

Getting started

To use Airtable Scripts on your base, you need to enable the scripting block. Airtable comes with a number of blocks that enable a specific set of functionality on your base - graphs and charts, CSV imports, page designer for printing data and so on. Learn more about Airtable Blocks here.

To install the Scripting Block, click on “Blocks” in the base header, then click on “Install a block”. Choose the scripting block from the list presented.

Now click on “Install” to add block to your base.

The script window has 3 areas:

  • The script window, where you write the script (top left in the image below)
  • The documentation and API area (bottom left)
  • The execution and output window (right)

The newly installed scripting block provides some default code, so let’s run that to see what it does. You should see this:

Let’s break the script down:

output.markdown('# Hello, world!');

The first line of the script simply outputs “Hello World” onto the screen. Markdown is a bigger topic, but is a way formatting text on a webpage, much like HTML.

Let’s edit this part of the script to simply show text:

output.text('Hello, world!');

Run the script again to see the difference.

The second part of the script allows you to input your name or some other text and then prints this out on the screen. The first part of this code sets up the input box and assigns the text you input to a variable called “name”. let is a Javascript way of declaring a variable that can be used in other parts of your script.

let name = await input.textAsync('What is your name?');

The final line of the script takes the variable name, which now contains the text you entered, and prints it out on the page:

output.text(`Welcome to the scripting block, ${name}.`);

Let’s change the script a little to see how you can affect how the script works and what the user sees. Perhaps we want to ask the user fo his/her favourite sports team. Change the text part of the input box code to make this clear:

let name = await input.textAsync('What is your favourite sports team?');

It is always a good idea to name variables in a way that gives you a clue as to what they are for. name is a bit too generic for our modified script, so let change it:

let favSportsTeam = await input.textAsync('What is your favourite sports team?');

Run the script again. You should see this:

Clearly, something isn’t correct as our inputted sports team name isn’t appearing in the output. This is because the output.text line refers to the variable name, which we have removed from the script. Change the output.text line to use our new variable favSportsTeam.

output.text(`Welcome to the scripting block, ${favSportsTeam}.`);

Run the script again and the output should now make sense.


  • Getting the script block enabled on your base
  • Running the default script
  • Displaying text on the output screen
  • Defining a variable
  • Modifying the default script and seeing the results