Skip to main content

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)

 

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.


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 😃.

Best,
Mike, Consultant @ Automatic Nation


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...



@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.


Hey @renewNiko!

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

Best,
Mike, Consultant @ Automatic Nation


Thanks Mike! 👍


Hey @renewNiko!

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

Best,
Mike, Consultant @ Automatic Nation


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


Reply