Airtable API Part 3: Create a new entry in Airtable

This is part three of our tutorial series on working with the Airtable API in dashdash. To follow along, make sure you’ve completed the previous tutorials.


Creating a new entry in Airtable is a little bit more complicated than just getting it. But don’t worry - in this article we’ll cover

  • Creating a JSON object
  • Modifying the object to match Airtable’s requirements
  • Creating the entry in Airtable using POST()

But first, let’s set up our PostToAirtable view by creating the following header rows:

Cell Content
B1 Remove square brackets
C1 Add “fields”
D1 POST request
E2 Create button.
A5 Copy in the entire header row from GetAirtableData, but remove the createdTime header.

It should look a little like this:

:memo: Note: Airtable is a bit funny in a way. When we send data, our table headers must be exactly the same as what is in the Airtable view. For example, if in Airtable the header is "id", but we send through "ID", then we will get an error. That’s why it’s always best to just get the headers using the GET request and then just copy them over.

Now, let’s just fill in some dummy data below the headers.

Cell Content
A6 My first post from dashdash!
B6 Feature
C6 It’s just easier with dashdash.

Now we can create our JSON object:

Creating a JSON object

Creating a JSON object in dashdash is very easy. All we need to do is select the header row (so the property for JSON) and the row with our dummy data (values).

Update your PostToAirtable with the following:

Cell Content


:memo: Note: For creating entries in Airtable, we don’t need the id (because there won’t be any as the entry hasn’t been created yet). However, to simplify some steps in a later article, we’ve kept it here.

If you click on the Data Explorer Data Icon icon in A2, you should see the following:

As we can see, we now have successfully created a JSON object! Before we can send it, we need to modify it slightly to match JSON structure Airtable expects.

Modifying the object to match Airtable’s requirements

If we have a look at how Airtable sends their data, and compare it to how our RANGE2JSON() function creates the JSON array, we’ll spot two key differences:

Airtable expects what we send is an JSON object (whereas we create a JSON array - as indicated by the square brackets) and that everything is “wrapped” in a fields object. So we need to:

  • remove the square brackets
  • add a "fields": object

We’ll update our PostToAirtable view with the following:

Cell Content Description
B2 =LEFT(RIGHT(A2,LEN(A2)-1),LEN(RIGHT(A2,LEN(A2)-1))-1) Removes the square brackets.
C2 =CONCATENATE('{"fields": ',B2,"}") Puts everything in a "fields": object.

:question: Why aren’t we using =SUBSTITUTE(SUBSTITUTE(A2,"[",""),"]","") in B2? Well, we only want to remove the first square bracket and the last, and not any in between.

If your view looks similar to the screenshot below, then you’re ready to create a POST request!

Creating the entry in Airtable using POST()

To create the entry in your Airtable account, we just need to do a simple POST() function. But because we want to be a bit fancy and only POST the entry when the Create button is pressed, we’ll need to wrap it around an IF() function.

Just add the following in your PostToAirtable view:

Cell Content Description
D2 =POST('Setup'!D5,'Setup'!E2,C2) This will create our entry in Airtable as soon as we press click the Create button.

In the end, your PostToAirtable view should look something like this:

Now all that’s left is to press the Create button, and our new entry will be created! If you click on the Data Explorer Data Icon icon in D2, you should see the following:


And that’s it! If you update your table in GetAirtableData (or just go to your Airtable account), you’ll see your new entry. Great!

And now that we have an entry there, let’s learn how to update it!

Up Next: Part 4 - Update an entry in Airtable

1 Like