Airtable API

With the growing popularity of Airtable, more and more people want the ease of the Airtable database approach with the functionality of a spreadsheet. Enclosed is an example for how to get data to and from Airtable.

Authentication

First, retrieve your bearer token by creating your access token here: https://airtable.com/create/tokens

Assign the necessary permissions: read, write, etc. (Note: write permissions do not give you read permissions)

Get data

Replace the bearer token, app_id, and table_id in the code below.

You can get the app_id and table_id by checking the URL of any of your Airtable tables. The app_id is the first string that is named app, e.g. app395hgzd948 and the table_id is the first string named tbl, e.g. tbl39328jgg9.

import requests
import pandas as pd

headers = {"Authorization": "Bearer <your_bearer_token_here>"}
response = requests.get('https://api.airtable.com/v0/<your_app_id_here>/<your_table_id_here>', headers=headers)

df = pd.json_normalize(response.json()['records'])
df

You can also submit data from your spreadsheets to your Airtable. Follow the Airtable docs for more endpoints and information: https://airtable.com/developers/web/api/list-records

Need help making this connection? Feel free to reach out to support@quadratichq.com for help.

Quadratic logo

The infinite canvas spreadsheet with code.

Try it now