This module allows to work with data stored in Airtable via Web API.
> nupm install --git [email protected]:GooRoo/Airtable.nu.git
> use airtableFirst, You need to create a Personal Access Token here.
To log in, use:
> airtable login 'your-PAT'This will store your auth information for the current session.
Personally, I use it together with 1Password CLI like this:
> op read "op://Vault/Airtable/API tokens/my-pat" | airtable loginTip
In all commands, entity names and their corresponding IDs (for databases, tables, fields, etc.) could be used interchangeably. The names look better but could be changed by someone (and you'll have to adapt your scripts), while IDs are uglier but unique and always stay the same.
Note
The operation requires schema.bases:read scope.
> airtable db listNote
The operation requires schema.bases:read scope.
> airtable db list | get 0.id | airtable db tablesIf you don't want to pass the database ID manually to all commands that require it, you can store it for the current session like this:
> let dbs = airtable db list
> airtable db use $dbs.0.idor as a one-liner:
> airtable db list | get 0.id | airtable db useNote
The operation requires data.records:read scope.
Simply call:
> airtable table show 'your-table-id'You can also pass the table ID via pipe:
> 'your-table-id' | airtable table showWarning
This command requires a database ID to which a table belongs. If you haven't chosen the active DB like it is shown above, you can pass it through the pipe:
> {base_id: 'your-db-id', table_id: 'your-table-id'} | airtable table showYou can also limit the fields you want to retrieve:
> 'Clients' | airtable table show --fields [Name Country Email]Additionally, you can sort the fields:
> 'Clients' | airtable table show --sort [[field direction];[Name asc],[Birthdate desc]]Note
Sorting on Airtable's backend side is not the same as sorting in Nushell! Consider the following:
'Clients' | airtable table show | take 20 | sort-by NameHere, you want to get information about the first 20 clients sorted by their names. However, the order, in which Airtable returns the records, is not specified. As a result, you get 20 random client records and then sort them by name. Instead, the correct way would be this:
'Clients' | airtable table show -s [{field: Name, direction: asc}] | take 20