Get a csv via API


#1

Is there any way to get a whole base csv via API? or Automation tool like zapier?


#2

You can’t directly request a CSV via the API, but you could definitely write a script to generate one. It’d be significantly less complicated if the API had the option to return data instead of references for linked records, but that comes with its own set of downsides as well. Anyway, I’m guessing you don’t want to write a script to do this or you’d have gone that route already, but you might not have to. While this won’t address linked records, you basically just need to make API calls to request data from the entire base (which is pretty straightforward even if you don’t know much about programming—Airtable’s API documentation is pretty awesome) and then use a JSON to CSV conversion script to get the data in the format you want. If you search the web for JSON to CSV script and the name of the language you want to use, you should have no trouble locating what you need.

That said, Zapier can do pretty much anything the API can do. If it can’t with the direct integration, you can use Zapier’s Webhook action (which you can add to their Push trigger if you don’t have another explicit trigger you want to use) to call the Airtable API directly and do whatever you want with it from there. You might want to go that route if you need to export an entire base because the official integration only connects to one table in a base at a time. The API also works like that, essentially, but the official integration won’t do anything with existing records—it has to think they’re new. There are some work-arounds for this but it’s easier to just make an API call in this case (in my opinion, at least).

Anyway, if you want to do this in Zapier you will need to create a zap that bulls all the base’s data in and, essentially syncs it somewhere else. Zapier can’t explicitly create a downloadable CSV so you’ll need to sync the data to something that can, like Google Sheets. You can then make an API call to Google Sheets to get the CSV (or another format, if you prefer—see here). Yeah, it’s kind of convoluted but unfortunately I can’t think of a more straightforward option. You might want to check out Clay, though, since it’s kind of a middle ground. You’d still have to write code but it provides some shortcuts that might make it easier to create the CSV you need.

I’m sorry I couldn’t figure out a more direct route, but hopefully this helps a little!


#3

Thanks for your advice!

In the view of Airtable API, it seems to limit 100 rows when I get all of records from the specific table.

Does someone have an idea to solve it?
My records which I want to get into CSV regularly are over 1000.