Get records from an Airtable table
air_get_records.Rd
Downloads an Airtable table into a list of records
Usage
air_get_records(
table,
base_id,
api_key = Sys.getenv("AIRTABLE_KEY"),
query = list()
)
Arguments
- table
name of the table (string)
- base_id
id of the Airtable base where the table is located
- api_key
API key for Airtable. By default it looks at the
AIRTABLE_KEY
environment variable.- query
additional parameters for the airtable query like for example fields, view, pageSize, maxRecords, sort, filterByFormula, cellFormat, timeZone, userLocale, etc... See the airtable documentation for more details.
Details
Airtable API returns one page of records at a time. Each page will contain
pageSize
(a query parameter) records, which is 100 by default. Internally,
this function will automatically download all records until maxRecords
has
been reached.
Examples
if (FALSE) { # \dontrun{
# Get all records for the table boats
air_get_records(table = "boats", base_id = "appjEVaN8kBNXAWak")
# Get records only in a specified view
air_get_records("boats", "appjEVaN8kBNXAWak",
query = list(view = "Boats with wrong registration")
)
# Get only the first 5 records
air_get_records("boats", "appjEVaN8kBNXAWak", query = list(maxRecords = 5))
} # }