Stuart Lansdale

Search Multiple Rows with Airtable and Zapier

Airtable is a great tool as it allows you to run databases without code. The flexibility of being able to build in a similar function to Google Sheets with added benefits like the Blocks functionality, adding files and images makes it a whole lot more powerful. One of the most frustrating things about Airtable though is that they do not have the ability to search multiple rows / entries with their Zapier integration. This is kind of a let down for a product which markets itself in the way it does as a de facto database replacement.

Have no fear though, it is still entirely possible to do this. You just however have to delve into the API a little and get your hands a bit dirty. I was looking for a way to do this personally. With Roomfilla, we have a ton of properties in an Airtable database. It would be good if we could pull all the URL listings of certain properties based on specific search terms – so we built that. Here is how you can use the API in Airtable to pull out multiple records.

This is unfortunately incredibly limited!

First you will need to go to the API page for Airtable. You can find it here. You can click on the base that the information you want to pull is located and you will then see certain details. In the top right, there is a show API key button. You want to click this as you will need this key. You then need to find the right URL for the webhook which is generally https://api.airtable.com/v0/BASEAPIID/TABLENAME. If you find the table on the left side and click it and scroll to the authentication section, you will actually see the URL you need to use and also the API key (if you ticked to show it). Perfect!

The next thing is to actually create the webhook in Zapier. For this you need to use the webhooks action step and make sure you choose the GET action. Put the URL in the top box and you then have the query string params. Here you will actually do the search so in the left box you want to put ‘filterByFormula’ and in the right box the actual formula. You could search multiple different fields here but a basic search would look like this. ‘({FIELDNAME} = ‘SEARCHTERM’). You also need to include another query string param field with ‘view’ on the left and ‘Grid view’ on the right.

After you have done the Query String Parameters you will see these boxes. You can just make sure they look like the above and it will work fine.

The last thing to do is to set up the headers. Here you will enter your API key and there is also another field you need to add otherwise it won’t work correctly. To add the API key put ‘Authorization’ in the left box. In the right box put ‘Bearer APIKEY’. In the 2nd header put ‘User-Agent’ in the left box and ‘null’ in the right box. Now you are all set. If you hit continue and test the step. You should see the correct fields being pulled out.

These fields will come out as line items / comma separated so to use them elsewhere you will need to use the formatter tool or some custom code to do the splitting how you would like. I wrote about how I did this previous to make a nice list using a little javascript code. You can read about creating lists in Slack with Airtable if you so wish.

Leave a Reply

Your email address will not be published. Required fields are marked *

Categories
Recent Posts
Blog Updates