Join The Founder's Inbox
Join 13k+ entrepreneurs and receive tutorials, tips, and strategies for building smarter digital products using no-code, AI, and automation.
Discover how to run scripts for multiple records in Airtable and master bulk updates with ease. Learn to use the for function to automate your workflows.
Learn how to create Stripe Payments directly in Airtable
Tired of spending hours manually updating records in Airtable, one by one? Imagine turning a tedious task that takes hours into a 30-second process! Whether youâre managing projects, tracking inventory, or updating customer data, this step-by-step guide will show you how to automate bulk updates in Airtable using a simple script. By the end, youâll not only save time but also feel empowered to tackle automation with confidenceâeven if youâre new to scripting.
What Weâll Cover:
Letâs transform how you manage Airtable today!
Imagine you need to update the status of all your records or adjust a field value for a large dataset. Doing this manually:
Using a script solves these issues by automating the updates. Airtableâs Scripting app allows you to write JavaScript code to make changes quickly and accurately.
Before we write and run the script, youâll need to set up the Airtable Scripting app. Hereâs how:
Here is the script weâll be using:
// Replace with your table name
const tableName = "YourTableName";
// Replace with the field name(s) you want to update
const fieldToUpdate = "YourFieldName";
const newValue = "New Value"; // Replace with the desired value
// Get the table
let table = base.getTable(tableName);
// Fetch records to update
let query = await table.selectRecordsAsync();
let records = query.records;
// Prepare an array for batch updating
let updates = records.map(record => ({
id: record.id,
fields: {
[fieldToUpdate]: newValue
}
}));
// Airtable API restricts batch size to 50
while (updates.length > 0) {
await table.updateRecordsAsync(updates.slice(0, 50));
updates = updates.slice(50);
}
output.text("Bulk update completed!");
â
Letâs understand how this script works step by step.
YourTableName
with the name of your table.YourFieldName
with the name of the field you want to update.New Value
with the value you want to apply to all records in that field.newValue
should be "Complete."let table = base.getTable(tableName);
retrieves your specified table in the base.await table.selectRecordsAsync();
gets all the records in the table so we can process them.updates
is an array where each entry specifies the record ID and the field value to update.while
loop to ensure this limit isnât exceeded.updateRecordsAsync
function updates each batch of records until all records are processed.YourTableName
, YourFieldName
, and New Value
) with your actual table and field details.Letâs say you have a table named âTasksâ with a field called âStatus.â You want to mark all tasks as âComplete.â Hereâs how the script would look:
const tableName = "Tasks";
const fieldToUpdate = "Status";
const newValue = "Complete";
let table = base.getTable(tableName);
let query = await table.selectRecordsAsync();
let records = query.records;
let updates = records.map(record => ({
id: record.id,
fields: {
[fieldToUpdate]: newValue
}
}));
while (updates.length > 0) {
await table.updateRecordsAsync(updates.slice(0, 50));
updates = updates.slice(50);
}
output.text("Bulk update completed!");
With this script, you can save countless hours and streamline your workflows in Airtable. Whether youâre managing a project, tracking inventory, or updating customer data, scripting is a powerful tool to add to your arsenal.
If youâre ready to take your Airtable skills to the next level, try out this script and watch how it transforms your productivity. Have questions or need further help?
Happy automating!
Join 13k+ entrepreneurs and receive tutorials, tips, and strategies for building smarter digital products using no-code, AI, and automation.
In most cases, yes.