Saw this when I was looking for the same solution.
It was frustrating, but I found the simplest answer…
Airtable secretly added an .all()
method which has been greatly under-reported.
For example, I have a base with a table called ‘Contacts’ and this will let me pull all and handle each:
const records = await base('Contacts').select().all()
console.log(records.length) // logs the quantity of records you've pulled
for (const record of records) {
console.log(record.id) // logs the record id
const name = record.get('name') // lets you grab and handle value
console.log(name)
// do other things, it's your life, whatever...
}
This was released officially on on Apr 29, 2017:
The “official” method is:
table.select({view: 'Main View').all().then(records => {
// records array will contain every record in Main View.
}).catch(err => {
// Handle error.
})
Hope this helps the next person. I spent hours looking for this obscure answer.
“WHY IS THIS NOT DOCUMENTED ON THE API PAGE” he shouted angrily, to an empty room.