A QGIS Processing script that imports records from an Airtable table or view directly into QGIS as a CSV-based layer — with secure, encrypted API key storage and support for automated, repeatable updates.
Note on how this was built: This tool was vibe-coded with the help of Claude Sonnet 5 (Anthropic). The author is not a professional software developer; the code has been tested for the described workflow but has not undergone a formal security or code review. Use at your own discretion, and feel free to open an issue or pull request if you spot a problem.
- Connects to the Airtable Web API and fetches records from a specified base, table, and (optionally) a filtered view.
- Lets you choose exactly which fields to import, and in which order.
- Writes the result to a CSV file on disk.
- Optionally loads that CSV directly into QGIS as a layer — and on repeated runs, reloads the existing layer instead of creating a duplicate, so that joins you've built against it (e.g. to a geometry layer) are preserved.
- Handles Airtable's array-type fields (multiple select, linked records, lookups, attachments) automatically, converting them into readable, comma-separated text.
- Remembers your last-used settings (Base ID, Table ID, View ID, field list, output path) per QGIS project, so repeated syncs require minimal re-entry.
This tool does not create geometry. It always produces a plain attribute table. If your Airtable base contains coordinate fields, see Working with coordinates below.
Your Airtable API key is never stored in plain text and never written into the .qgz/.qgs project file.
Instead, the script uses QGIS' built-in, encrypted Authentication Database:
- The key is entered once into a QGIS "Basic authentication" configuration, which QGIS encrypts and stores in your local profile, protected by a master password you set.
- Only a short, meaningless reference ID to that configuration is saved in the project file — this ID is useless to anyone without access to your local, encrypted authentication database and your master password.
- All other settings (Base ID, Table ID, View ID, field list) are stored in plain text in the project file, as they are not considered sensitive on their own.
See Setup below for how to create the authentication configuration.
- QGIS 3.x with the Processing Toolbox
- Python
requestslibrary (included with most QGIS installations; if missing, install via the OSGeo4W shell:pip install requests) - An Airtable account with API access to the base you want to import from
- Download
airtable2qgis.pyfrom this repository. - In QGIS, open Processing → Toolbox.
- At the bottom of the toolbox, click the Scripts icon → Add Script to Toolbox... (or open the Script Editor and paste the contents, then save it into your
processing/scriptsfolder). - The tool will appear in the toolbox under Scripts → Airtable2QGIS.
- Go to airtable.com/create/tokens.
- Click Create new token.
- Add the scope
data.records:read. - Under Access, select the base you want to import from.
- Create the token and copy it immediately — it is shown only once.
- Open the Airtable2QGIS tool from the Processing Toolbox.
- In the "Airtable authentication" field, click the green + button.
- Choose Basic authentication as the authentication method.
- Choose a Username and paste your Airtable API key into the Password field.
- Give the configuration a name, e.g.
Airtable API Key, and save it. - If this is your first time using the Authentication Database, QGIS will ask you to set a master password for your QGIS profile. This protects everything stored this way — remember it, as it cannot be recovered.
Once created, this configuration is reusable across projects and other tools, and will be pre-selected automatically the next time you run this tool in the same project.
| Value | Where to find it |
|---|---|
| Base ID | Open your base in the browser. The URL looks like airtable.com/appXXXXXXXXXXXXXX/... — the part starting with app is the Base ID. |
| Table ID | Open the relevant table. The URL extends to .../tblXXXXXXXXXXXXXX/... — the part starting with tbl is the Table ID. |
| View ID (optional) | Open the relevant view. The URL extends further to .../viwXXXXXXXXXXXXXX?... — the part starting with viw is the View ID (ignore any ?... suffix after it). If left empty, all records of the table are imported. |
| Parameter | Required | Description |
|---|---|---|
| Airtable authentication | Yes | The saved authentication configuration containing your API key (see Setup). |
| Base ID | Yes | See table above. |
| Table ID | Yes | See table above. |
| View ID | No | See table above. Restricts the import to records visible in this view. |
| Fields | No | Comma-separated list of field names, exactly as spelled in Airtable, in the desired column order (e.g. Name, Status, Date). Leave empty to import all fields, in the order returned by the API. |
| Output CSV file | Yes | Where the resulting CSV file is written. |
| Load layer into QGIS after import | Yes | See workflow below. |
First import:
- Fill in authentication, Base ID, Table ID, and (optionally) View ID / Fields.
- Choose a file path for the CSV output.
- Enable "Load layer into QGIS after import."
- Run the tool. A new layer is added to your project.
- Set up any joins (e.g. to a geometry layer) against this new layer as usual.
Subsequent imports (updates):
- Run the tool again with the same output path.
- Leave "Load layer into QGIS after import" disabled.
- The CSV file is overwritten in place. The existing layer already points to this file, so any joins remain intact.
- If the update isn't reflected immediately, right-click the layer → Reload, or press
F5.
Re-enabling "Load layer" on a re-run is safe (it detects the existing layer by file path and reloads it instead of duplicating it), but leaving it off avoids unnecessary processing if you already have the layer loaded.
This tool always imports data as a plain attribute table, without geometry. If your Airtable base contains coordinate fields (e.g. X/Y, Longitude/Latitude), you can generate point geometry from the imported table using QGIS' native "Create points layer from table" algorithm:
- Run Airtable2QGIS first to produce the attribute table / CSV layer.
- Open Processing Toolbox → Vector creation → Create points layer from table.
- Select the layer produced by Airtable2QGIS, specify your X and Y field names and the correct EPSG code.
- Airtable's REST API is limited to 5 requests per second per base, regardless of your Airtable plan. Very large tables may take a while to import due to pagination, and the tool will automatically wait and retry if this limit is hit.
- Attachment fields are reduced to their file URL(s); the files themselves are not downloaded.
- Multi-select, linked record, and lookup fields (which Airtable returns as arrays) are automatically joined into a single, comma-separated text value.
- Geometry import (points from coordinate fields, or WKT/GeoJSON geometry stored in Airtable) is not built in — see Working with coordinates for a native QGIS workaround for point data.
MIT - License
Th. Leutgeb — Stadtarchäologie Wien
0 comments
log in to comment.