Help

Can Airtable's own "Export CSV" be triggered via a script?

Topic Labels: Scripting extentions
18227 27
cancel
Showing results for 
Search instead for 
Did you mean: 
Markus_Wernig
8 - Airtable Astronomer
8 - Airtable Astronomer

Here’s my thinking. I like the simplicity of Airtable’s own “Export CSV” function. Data in a spreadsheet as a simple backup is all I am after.

If “Export CSV” could be triggered via a script, the entire process could be automated. A new record could be the trigger to run this script.

Does anyone know if this is even possible?
Thank you!

27 Replies 27

You cannot trigger the existing “Download CSV” feature in Airtable with a script. However, it is possible to use scripting (either in scripting app, or with an automation scripting action) to convert the existing data to CSV format and save that data to a website. The exact details would depend on where you want to save the data.

Thanks, Kuovonne.
Could the resulting CSV data be saved to a dropbox location?

What is the difference between the “scripting app” and a “scripting action” - the latter is what I am most interested in, since it can be used with the new “automation” feature.

Another question - in a “CSV export via script”, does everything show up as text, even records that are from linked fields? That’s the reason why I am on this search for a simple solution. There is at least one existing third party solution that does what I am looking for - automatically export a table as a CSV file to dropbox. But every third party service has to go through Airtable’s API, which has the following limitation: whatever isn’t text already, like linked records, doesn’t come across as text.

I am grateful for any hint or help. Thank you!

A script app is a script feature that you program and then run as needed. A script action is fundamentally the same, but embedded inside an automated action process. You can see each type in the UI by selecting Automations or Apps.

image

Yes. all text because - CSV requires all text and is therefore not the most ideal way to create a backup strategy.

Not entirely true.

You are free to build an API-driven backup system that uses links to access other content to pull it into a more comprehensive backup process and output. This is where your requirement that it be “simple” becomes “complex”. :winking_face:

And to make matters worse, the vast critical elements of an Airtable solution cannot be accessed by the API or the integrated CSV export. Business logic embedded in formulas - for example - cannot be backup up at all. This article covers a number of these backup and restoration issues.

Thanks, @Bill.French

I appreciate you walking me through the complexity of the task at hand.
I fully understand where you are coming from and yes, a CSV export will never be an actual backup solution for a complex Airtable base with formulas and everything.

In my case, Airtable’s own “Export CSV” is perfectly fine. I am just interested in having our company data (“inventory”, “projects”, “income”) backed up in good-old spreadsheets - and I’d like this to happen without me having to do it manually. I am not looking for a way to preserve the complexity of the entire base in a backup solution (however nice that would be).

If only Airtable would allow their own “Export CSV” function to be an automation “action” that could be “triggered”, I’d be perfectly happy. Well, I did suggest it to them. Let’s see what happens.

And to make matters worse, the vast critical elements of an Airtable solution cannot be accessed by the API or the integrated CSV export. Business logic embedded in formulas - for example - cannot be backup up at all. This article covers a number of these backup and restoration issues.

Not true anymore, I played around with the Airtable Apps, and built https://github.com/UnlyEd/airtable-app-bases-compare, I wanted to deep-compare bases using an app, but faced a limitation that those data are only accessible for the current base.

So, I changed my mind and eventually build a “print-base-structure” airtable app. Then, I use a diff tool to compare the generated output, and it allows me to see what structural differences there are between two bases.

It’s much better than the API, there are more insight about the base structure (type of fields, options, etc.).
There still isn’t everything I’d like (like, the actual formula being used), but it’s better than before. More use-cases are possible compared to the API.

Off topic, but I’m also currently working on a “fetch-airtable-dataset” project that I might open source eventually.
The goal being to fetch like 1-100 tables at once, sanitize the dataset, and then perform consolidation (resolving relationships) based on one own’s business needs. It’s a tool meant for developers.

So it is true – the API is [still] not able to expose the business logic of an Airtable solution (such as field formulas) and your approach doesn’t [apparently] expose the field formulas either. I’m curious why you believe my assertions are untrue. To be clear - I look forward to the day when I am wrong about this. :winking_face:

Lastly, please know that the article you are claiming is untrue was penned in 2019 - a lot has changed with the script environments and effortless access to the complete data schema through javascript.

Indeed, much can be done with React and deep introspection of bases. Is it practical for most users? Probably not.

In your Githib project I didn’t see any evidence of actual formulas in fields. Is that possible with your approach? If it is, you should build an actual backup/documentation service that creates content to help users capture the true details of their solutions.

Ahmed_Elagami
7 - App Architect
7 - App Architect

Hi Markus,

Well, I was just thinking exactly the same thing, I am using 2 approaches to achieve that
1- I randomly go to History and goes to take a snap of an existing base, what it does it creates another copy of your base to your workspace depending on your account subscription without affecting your current base.
image
image

so this way gives me the option to go back for 1 full year of history of my base, around 10 versions for the last 24 hours and at least 1 for each previous day.

2- I use open2air paid service to create a back totally automated.
so once you link your open2air account to Google drive or dropbox, then you can create a backup plan to backup your existing base every hour every week or every month. it creates a CSV file has all record Ids and all files, all attachments. you can download that anytime, and build up your base again if ever needed.
full info in this link

I hope that helps
Thanks
Ahmed

Thank you so much, @Ahmed_Elagami, for these great tips. I’ll start using snapshots as well. And On2Air Backups might indeed be exactly what I was looking for.

They seem expensive at first, but once you boil it down to what you actually need, it’s a no-brainer for business data security.

I’ll do a test run with them, but maybe you can answer one question first.

Like every Airtable user, I’ve got a ton of linked records and lookup fields. Do these fields come across as data in their CSV export - the same way as when I do a manual “Export CSV” through Airtable’s own menu?

Thanks - Markus