Help

Re: Script to clear all records or table

Solved
Jump to Solution
508 2
cancel
Showing results for 
Search instead for 
Did you mean: 
renewNiko
4 - Data Explorer
4 - Data Explorer

Any way to clear all records or delete a table through script?

This don't work:

do
{
let table = base.tables.pop();
console.log(`Goodbye, ${table.name}!`);
}
while(base.tables.length>0)

 

1 Solution

Accepted Solutions

Hey @renewNiko!

I just sent you my own version of the script via PM, in case @kuovonne did not send that over yet :D.

Best,
Mike, Consultant @ Automatic Nation

See Solution in Thread

6 Replies 6

Yes, it is possible to delete all records in a table through a script. The script is actually a very simple one; however, because it is so destructive, I don't feel comfortable posting a version.

 

It is not possible to delete the table itself via scripting.

Where did you get the code you posted? It looks like code for removing items from an array one at a time, which is very different from deleting an actual table.

Would you care to share why you want to delete all the records in a table or delete the table itself via code? Usually these things are done very infrequently and thus can be done via human interaction.

Thank you for the reply. There is a third-party integrations that feeds data and they can't keep track of changes/new rows in the data so they send everything. Therefore, I would like to empty the table every day.

I would be grateful if you posted that simple script. PM me if you like, the risk is on me 🙂

ps
the script I posted was something I just came up with just using IntelliSense...

Hey @renewNiko!

I just sent you my own version of the script via PM, in case @kuovonne did not send that over yet :D.

Best,
Mike, Consultant @ Automatic Nation


@renewNiko wrote:

the script I posted was something I just came up with just using IntelliSense...


Thank you for saying how you got the code. Looks like IntelliSense doesn't know anything about the Airtable scripting environment. I would not trust it to come up with an Airtable script.

Thanks Mike! 👍

Hello Mike, can you send me the script too? 🙂