Airtable is a popular spreadsheet software and cloud collaboration tool.
In this tutorial, we’ll show you how to connect the Airtable REST API to Google Sheets in 5 steps:
Apipheny is an API connector for Google Sheets. You can use Apipheny to connect your Google Sheets to unlimited API data sources, make unlimited API requests, and more. There is a 30 day free trial included.
1.) Install Apipheny by opening the following link on desktop and then clicking the Install button in the Google Marketplace: https://apipheny.io/install
2.) After you’ve installed Apipheny, open a Google Sheet and then click on the Extensions dropdown in the menu at the top.
In the dropdown list you should see Apipheny. Click Apipheny then click Import API to open the Apipheny sidebar in your Google Sheet.
Tip: you can open a new Google Sheet by entering this URL in your browser: sheet.new
First make sure you’re logged in to your Airtable account.
Next, click on your account icon to display a drop-down menu, then click the Account item:
The Account overview page will then be displayed. Click the Generate API key button to generate an API key:
Your API key is now generated:
Click the key cassette to view your API key and copy and paste your API key in a safe location because you will need it in the next steps:
In this section, we’ll show you how to browse the Airtable API documentation to find the endpoint URL that retrieves the information you need from your Airtable account.
If you already know your API URL, or you want to use the same example URL as us, just skip to Step 4.
First, open the Airtable API documentation page by clicking the Help icon in your account, and then choose the <> API documentation option:
The API Reference page will be displayed. The left menu contains general information about the Airtable API and a list of endpoints:
Click on a base available in your account. If you previously created a base in your workspace, beside the existing ones, it will be available in this list.
In this example, we chose Project tracker:
In this example, the Airtable API for the Project tracker’s main page was displayed.
The menu on the left contains an INTRODUCTION section and a list of tables, each with its own endpoints:
For example, when clicking the Clients table, the page scrolls to an introductory section and a list of its 5 endpoints:
All API calls to Airtable should be made with this base URL:
https://api.airtable.com/v0/
An example Airtable endpoint is Retrieve a record endpoint, and this is what the whole API URL looks like when put together:
https://api.airtable.com/v0//Clients/
Each endpoint’s documentation contains descriptions of the endpoint’s purpose and parameters. On a separate column on the right, you can find the CURL request to the endpoint, the available parameters, the expected response and an example response:
The Delete Design projects records endpoint, which delete records from Design projects:
Method: DELETE API URL Path: https://api.airtable.com/v0/appGgtbrk5QjfW9th/Design%20projects?records[]=recGvT8ScdaBzhfEX&records[]=rec0c7CUGOp3YyoGv Headers: Header 1 Key: Authorization Header 1 Value: Bearer your_API_key
Make sure to replace your_API_key with the key you previously obtained.
The List Tasks records endpoint, which lists the records from Tasks:
Method: GET API URL Path: https://api.airtable.com/v0/appGgtbrk5QjfW9th/Tasks?view=All%20tasks Headers: Header 1 Key: Authorization Header 1 Value: Bearer your_API_key
Make sure to replace your_API_key with the key you previously obtained.
The Update Tasks records endpoint, which updates the Task records:
Method: PATCH API URL Path: https://api.airtable.com/v0/appGgtbrk5QjfW9th/Tasks Headers: Header 1 Key: Authorization Header 1 Value: Bearer your_API_key Body: { "records": [ { "id": "recaSIYr2VQfbGbWi", "fields": { "Name": "Research other coffee packaging", "Subtasks": "[ ] Research other coffee brands'\'' packaging\n[x] Research sustainable materials options\n[ ] Color palette exploration\n", "Assignee": { "id": "usrQjmKTBNxfXNmmR", "email": "katherineduh+collab16@demo.htable.com", "name": "Jordan Peretz" }, "Time estimate (days)": 2.5, "Design project": [ "recGvT8ScdaBzhfEX" ] } }, { "id": "rechu4sYouRH61qE0", "fields": { "Name": "Design clamshell case hinge", "Subtasks": "[x] Complete client brief\n[x] Schedule initial meetings\n[x] Deliver initial designs\n[x] Iterate on feedback\n[x] Ship final changes\n", "Completed": true, "Assignee": { "id": "usrArxKAc5yNZQfxl", "email": "katherineduh+collab5@demo.htable.com", "name": "Bailey Mirza" }, "Time estimate (days)": 15, "Design project": [ "recBOmNHEQelRKvhh" ] } } ] }
Make sure to replace your_API_key with the key you previously obtained.
The Body value is just an example. Write your own records to be modified.
Pagination is a process that is used to divide a large dataset into smaller chunks (pages). Usually the endpoints that return a list of resources support pagination.
Some of the Airtable API endpoints use the pagination option. This means you need to add some of these parameters at the end of the URL.
The server returns one page of records at a time. Each page will contain pageSize records, which is 100 by default.
If there are more records, the response will contain an offset. To fetch the next page of records, include offset in the next request’s parameters.
Pagination will stop when you’ve reached the end of your table. If the maxRecords parameter is passed, pagination will stop once you’ve reached this maximum.
Example: https://api.airtable.com/v0/appGgtbrk5QjfW9th/Clients?maxRecords=3&view=All%20clients
The response will contain an offset parameter:
"offset": "itrmWvQJC7dzLEGk5/recB8CIyWRLNLld3k"
The next page call will be like this:
https://api.airtable.com/v0/appGgtbrk5QjfW9th/Clients?maxRecords=3&view=All%20clients?offset=itrmWvQJC7dzLEGk5/recB8CIyWRLNLld3k
Now go back to your Google Sheet and make sure that the Apipheny add-on is open, on the “Import” tab. With the Import tab open, enter these details into the add-on:
Method: At the top of the Apipheny sidebar, select the HTTP method (GET or POST) required by your API endpoint. For this example, we are using the GET method.
API URL: In Step 3, we explained how you can find the Airtable REST API endpoint that you need. Now copy and paste your complete Airtable API URL into the Apipheny add-on, where it says API URL Path, followed by any GET parameters required for your query (if applicable).
For this example, we are using the List records endpoint for the Design Project table, that lists records in Design projects. The parameters must be URL encoded. This is what the whole URL looks like:
https://api.airtable.com/v0/appGgtbrk5QjfW9th/Design%20projects?maxRecords=3&view=All%20projects
If you’re following the same example as us, you can copy and paste this URL into the API URL field in Apipheny.
Headers: In the Headers section of Apipheny, add one row with the following key and value:
Header Key: Authorization Value: Bearer your_API_key
Copy the header key and value into Apipheny, where it says Headers. Where it says your_API_key, copy and paste your key that you got in Step 2. Don’t forget to put the word Bearer before your token. There should be a space between Bearer and your_API_key.
Here’s what your Airtable API request will look like entered into Apipheny, if you’re following the same example:
Finally, click the Run button at the bottom of the Apipheny add-on and then wait for the Airtable API data to be imported into your Google Sheet.
Congratulations! You’ve successfully connected the Airtable API to your Google Sheet and imported Airtable data into your sheet.
After making a successful request to the Airtable API, try querying a different Airtable API endpoint, or try using one of the more advanced features in the Apipheny add-on.
Crypto API tutorials and more:
Sponsored by Zink Virtual Tip Jar & Rewording.io Paraphrasing Tool
Accept donations on Twitch | Accept donations on Discord | Accept donations on YouTube | Accept donations on Telegram | Accept donations on Twitter | Accept donations on TikTok | Accept donations on Instagram | Accept donations on LinkedIn | Accept donations on Facebook | Accept donations on your Website