Airtable scripting uses JavaScript to read records, apply custom logic and write results back to a base. Use it when a built-in field or automation action can't express the rule clearly: a custom batch update, a carefully defined duplicate check or a request to an outside API.
Use the scripting extension when a person should review and run the job. Start with the read-only Requests example. For a background step, use Run a script and follow the example that passes one record from its trigger. Keep a native action when it already does the job, because code adds another rule someone must maintain.
I'd start a bulk cleanup in a copy of the base with a person reviewing the proposed changes. Move it into an automation only after the record selection, write rules and rerun behavior are clear. The Orders table still holds each order once; the script reads those records and changes only the fields its job requires.
Check access before choosing a route
The scripting extension is available on paid plans, and an organization can restrict its use. Free doesn't include Extensions. The background action has its own eligibility rules: Free cannot use Run a script, and Team plan trials exclude that action. A trial's other automation allowances don't establish scripting access.
Owners and Creators can add or modify extensions and configure automations. Editors can adjust an already configured extension, but cannot create or edit an automation. The extension respects the permissions of the person running it; code doesn't grant permission to change a protected table or field. Before upgrading, check whether a built-in action or a field already solves the problem.
A background script also draws on the workspace's monthly automation-run allowance. Airtable counts a run whenever the trigger is invoked, including failed attempts. A script step is part of that run; the allowance isn't a count of records the script can update. See Airtable automations for the trigger-and-action model.
Choose who starts the work
| Route | Choice and responsibility |
|---|---|
| Built-in field or automation action | Choose it when: The documented feature already expresses the calculation or action. Who maintains the rule: The person configuring the field or automation. |
| Scripting extension | Choose it when: A person should inspect inputs, run a batch and review its output. Who maintains the rule: Someone who can understand the script and its configured targets. |
| Run a script action | Choose it when: A trigger should start custom logic without a person answering prompts. Who maintains the rule: Someone who owns the code, automation inputs and failures. |
The automation scripting guide distinguishes foreground and background execution. An extension can interact with its user. An automation script can't pause for an interactive answer, so every required input must already be available when the run starts.
Airtable has a native Delete record action, so deletion alone isn't a reason to add a script. A Count field can count linked records without code. For a due-date notification, begin with email reminders; add scripting only for a specific rule the existing steps cannot express.

Know which JavaScript environment you're using
Inside Airtable, you work with objects such as base, table and record. You don't need a personal access token just to use that scripting API within its current base. Python belongs to a separate, external integration using the Web API; pasting a Python example into the JavaScript editor won't convert it.
The developer overview recommends basic JavaScript. Start with variables, objects, arrays, conditions, filter(), map() and async/await. In the example below, the Airtable call loads the records; ordinary JavaScript chooses which records to display. A formula expression such as IF({Status}="",...) belongs in a formula field, rather than this editor.
Start with a read-only review list
In a copied base, open Tools → Extensions → Add an extension, search for Scripting, then choose Add → Add extension → Get started → Start from Scratch. These are the steps in Airtable's extension setup instructions. The code editor holds the script; the results pane has its Run button.
For this educational example, use a small Requests table with a text field called Request and a single select called Status. The rule is narrow: a request whose Status is empty should appear in a review list with Needs review proposed. This script only reads records and displays that list; it contains no record-write operation.
const table = base.getTable("Requests");
const query = await table.selectRecordsAsync({
fields: ["Request", "Status"]
});
const proposed = query.records
.filter(record => record.getCellValueAsString("Status") === "")
.map(record => ({
recordId: record.id,
request: record.getCellValueAsString("Request"),
oldStatus: "",
proposedStatus: "Needs review"
}));
output.table(proposed);
| Sample request and Status | Expected review result |
|---|---|
| Order question — empty | Listed with its actual record ID; proposed Status: Needs review. |
| Address change — New | Excluded: Status already has a value. |
| Return request — Needs review | Excluded: the desired value is already present. |
Run it in the copy and compare the displayed IDs and request names with those records. Confirm that Status stays unchanged. A wrong table or field name requires correcting the named target; an empty review list can simply mean every selected record already has a Status. Keep this review output separate from a future update step, which needs the documented single-select write format and permission to change the field.
Read the field's value before choosing its write format
A displayed cell isn't necessarily a string. The Record reference separates raw values from formatted strings: getCellValue() returns the field's native structure, while getCellValueAsString() returns display text. In the review example, a string is enough to identify a blank Status and show a request label. A rule that needs a select choice, a quantity or a linked record should inspect the actual structure.
| Field and value to inspect | Write shape and trap |
|---|---|
| Single select: selected choice object | Use {name: "Needs review"} for an existing choice, or its choice ID. Comparing a raw choice object to "New" won't compare its name; read status?.name. |
| Multiple select: array of choices | Use an array such as [{name: "Urgent"}], rather than an array of strings. Writing that array replaces the existing selection; include any choices you mean to keep. |
| Link to another record: array of linked records | Write an array of {id: ...} objects for records in the linked table. A displayed customer name doesn't identify that customer reliably. The supplied array replaces the existing links. |
| Number or Percent: numeric value | Write a number without display decoration. A Percent value of 0.25 represents 25%; 25 represents 2,500%. |
| Formula, Lookup or Rollup: derived result | These are read-only cell values. Change the appropriate source field or linked record; don't try to overwrite the calculated output. |
These shapes come from Airtable's cell values and field options reference. Decide what an empty value means before mapping it. In particular, preserve zero when zero is valid; don't use a truthiness check as a substitute for checking whether a number is absent.
For the Requests example, create the Needs review Status choice before enabling any write. Keep the field type stable while reviewing the script. Renaming a label or converting a field can change what its readers expect, so record the input and output types beside the rule's owner. The field-type guide explains the neighboring design choice.
Name the custom rule before writing it
Airtable's scripting examples include validation, batch creation and deduplication. Those are categories of work. Your script still needs an exact definition of which records qualify and what should happen to each.
- Bulk updates: say an educational Orders table needs a review flag when several fields meet a custom combination. Define the fields to read, the exact condition and the one field to write. Keep customer details in Customers rather than copying them into every order during the update.
- Deduplication: choose the match key, the record to retain and how conflicting values will be resolved. Two contacts sharing a company name aren't necessarily duplicates. Produce a review list before enabling any merge or deletion.
- An outside API: use a script when the workflow needs an HTTP request that the available native actions don't provide. Decide what data leaves the base, what response is useful and where that result belongs.
The Run a script action supports external requests through fetch. The other service controls its authentication, endpoint and usage rules. Writing to another Airtable base also needs appropriately scoped credentials; the script's location doesn't grant access to that base. Use the Airtable Web API when that separate connection is the job.
For a background script that needs a credential, use the action editor's Variables → secrets option and the input.secret access pattern described in the Run a script guide. Review who can access the secret: Airtable restricts editing of scripts containing secrets and redacts their values from console output. Keep credentials out of shared script settings and ordinary logs.
The fetch reference separates browser and server requests. An extension's browser fetch can encounter CORS restrictions; its extension-only remoteFetchAsync sends a request from Airtable's servers. Automation fetch also runs outside the browser. Moving the request changes its environment, so check the endpoint's requirements before treating an extension example as an automation recipe.
Use a duplicate marker as a review step
Airtable's Mark duplicate automation example takes a recordId input and expects a Duplicate of field that links to the same table. It looks for other records with the same name and writes links to the matches. It doesn't merge records or decide which conflicting value should survive.
For an educational Requests table, that gives you a useful review pattern: keep each submitted request, link possible matches, then let someone compare them. A repeated title can describe two different requests, so choose a match rule that fits your records before adapting the example. If your rule reads a request number or customer link, include those fields in the query rather than relying on a displayed name alone.
Check the linked-record write format before saving matches. It takes an array of record-ID objects, and the array you write replaces the field's existing links. Decide whether the job should preserve those links, replace them or clear them. A marker that silently removes an earlier review link can lose useful context even though it deletes no record.
Keep extension settings and automation inputs distinct
The extension's script settings can let a collaborator choose a table, field or view instead of hardcoding its name. Its input.config(settings) call defines the settings once at the top of the script. Chosen values persist between runs and are shared among collaborators. Review the configured targets before a write, and don't treat shared configuration as private storage for a user's secrets.
In an automation, input.config() reads the action's configured inputs without a settings argument. Required values must come from its input configuration, such as a record ID supplied by the trigger. Moving an extension script into an automation therefore means reviewing its inputs and outputs as well as its record logic.
| Need | Extension and automation behavior |
|---|---|
| Choose a record during the run | Scripting extension: Run a script action: Pass the record ID into the action before the script starts. |
| Show a review table | Scripting extension: Run a script action: Use logs for diagnosis; a displayed extension table isn't an automation handoff. |
| Pass a value to a later action | Scripting extension: Displayed output serves the person running the extension. Run a script action: |
The reference marks interactive input methods as extension only and output.set() as automations only. Passing a value to another action doesn't write that value into a record. A field changes only when the workflow includes the corresponding write.
Pass one record through a background automation
Keep the same Requests table and the same rule: propose Needs review only when Status is empty. This example separates the calculation from the write, so the field being changed stays visible in the automation builder.
- In a copied base, open Automations and create an automation. Choose the trigger that represents a request becoming ready for review, then test it with a specific sample record.
- Add the Run a script action and open its editor. In its input variables, name a variable
recordIdand map its value to the triggering record's Airtable record ID. Don't map the request title or paste a fixed ID for every run. - Use the illustrative code below to retrieve that record and expose a proposed value. Include the exact Status field in the read.
- Test the script step. Inspect its output for an empty Status and an already-filled Status before adding a write.
- Add a conditional group that continues only when
shouldUpdateis true. Inside it, add Update record: table Requests, record ID from the trigger, Status from the script'sproposedStatusoutput. - Review and test the write in the copied base. Confirm the chosen record changed and a nonmatching record stayed unchanged, then enable the automation when its trigger and rerun behavior are ready.
const {recordId} = input.config();
if (typeof recordId !== "string" || recordId === "") {
throw new Error("Map recordId to the triggering record ID.");
}
const table = base.getTable("Requests");
const record = await table.selectRecordAsync(recordId, {
fields: ["Status"]
});
if (!record) {
throw new Error("The request record is unavailable.");
}
const status = record.getCellValueAsString("Status");
const shouldUpdate = status === "";
output.set("shouldUpdate", shouldUpdate);
output.set("proposedStatus", shouldUpdate ? "Needs review" : status);
The official action walkthrough uses this input → script → output → Update record pattern; the single-record query returns null when the record can't be found. The conditional branch protects a filled Status from a needless write. It doesn't provide a transaction lock: if people can change Status between the read and update, account for that competing edit in the workflow.
I prefer the separate Update record action for a simple write because the next maintainer can see the target field without reading code. Put the write inside a script when the task needs a custom batch or several dependent decisions, and retain the same preview and record-ID checks.
A displayed output value doesn't mean a field was saved. Conversely, clicking a script's test button can perform real writes if that script contains write calls. The two examples here only read records and expose values; a subsequent Update record action is a separate write that needs its own review.

Fit the batch inside the action's limits
The Run a script limits apply to that automation action. Airtable describes the overall timeout as temporarily increased to 120 seconds for observation and testing. The scripting API has a separate 12-second timeout, and fetch requests time out after 30 seconds. A longer overall cap doesn't remove those shorter boundaries.
| Action limit | Design consequence |
|---|---|
| 512 MB memory | Read only the records and fields the task needs. |
| 50 fetch requests | Bound the number of external requests in one run. |
| 30 selectRecords queries | Plan the reads before repeatedly querying inside a loop. |
| 6 MB output data | Pass the small result the next action needs, rather than an entire base. |
| Up to 15 mutations per second | Control writes rather than assuming an unlimited update loop. |
| Up to 50 records per mutation | Split a larger write set into bounded batches. |
These are caps, not a guaranteed processing rate. Multiplying the mutation figures doesn't establish how long your job will take, especially when it also queries records or waits for another service. The scripting extension has its own 50-record batch cap and approximately 15 requests per second; the Web API has a separate contract. Recheck the relevant environment before designing a long-running job around it.
The Table API documents record reads and writes separately. Use selectRecordsAsync() with an explicit field list that includes every field the rule reads; the primary field isn't included automatically. Await record operations, and keep each updateRecordsAsync() call within its 50-record maximum. The reference documents permission and invalid-cell-value errors. If a write fails, check the target field's value format and permissions before repeating it.
For a hypothetical 125-record update, the 50-record call maximum means at least three write calls: 50 + 50 + 25. That's batch arithmetic, not a speed measurement. Await each batch, preserve its completed IDs and stop to reconcile a failure. A large Promise.all() over individual writes doesn't turn those caps into unlimited capacity.
Find the first failing boundary
Start with the failed step's input and error, then follow one record. In an automation, open the run history and its Execution log. In an extension, check the results/error pane and the exact line. The useful question is which boundary failed: finding the record, reading its fields, computing the result, saving it or calling another service.
| Symptom | Check, then act |
|---|---|
| Script action or extension missing | Check paid-plan eligibility, Team trial restrictions, your role and organization restrictions before changing code. |
| Table or field can't be found | Compare its exact name with the correct base. Inspect renamed fields and the selected table; use configured targets or IDs when a name is expected to change. |
| Missing record or undefined input | Check the configured recordId value and its spelling in input.config(). Reselect a valid trigger sample. Handle a missing record before reading its cells. |
| A condition never matches | Inspect raw value versus display text. For a Single select, compare its choice name or use the formatted string. Verify the required field was selected in the query. |
| Invalid cell value or forbidden update | Check the destination field's write shape, existing select choices and edit permissions. Write the source data for a computed field. |
| Result looks right; field unchanged | Confirm there is a write action after output.set(), its conditional group is reached and it uses the triggering record's ID. |
| Works in extension; fails in automation | Replace interactive prompts and output.table() with configured inputs and automation outputs. Check fetch environment and limits separately. |
| Timed out, or only part of a batch changed | Reduce selected records/fields and external calls. Identify completed IDs before retrying; don't assume a failed run changed nothing. |
An interface button adds another boundary. Airtable's action help warns that a missing selected/visible record or fields not exposed on the interface page can lead to a disabled button or Invalid input. Check the page context before rewriting a working calculation. A checkbox-driven record automation can be an alternative when the necessary fields shouldn't be displayed there.
When an automation never reaches the script, follow the trigger and run-history checks. A script can't repair a trigger that didn't invoke it. Also avoid blind retries: Airtable counts failed and successful triggered attempts against the workspace's monthly automation allowance.
Verify a small batch before allowing writes
Airtable recommends trying sample scripts in a copy of the base, because examples can modify record values. Its guidance also recommends narrowing reads to the needed view and fields. Use that as the starting boundary for a script someone else supplies.
- Copy the base and identify the table, record selection and fields the job may change.
- Require a preview mode in the script that lists proposed changes without writing. Include an ordinary matching record, a nonmatching record and an empty or conflicting value.
- Compare each proposed write with the intended rule. Check the record ID and old and new values; don't approve a count alone.
- Allow a small write batch in the copy. Log planned and completed record IDs, counts and failures without tokens or other secrets.
- Decide what a rerun should do. After a partial failure, reconcile completed work before retrying, especially if a second attempt could create another record or repeat an external request.

Give AI a bounded job, then review its data decisions
Describe the environment, table and field types, trigger inputs, permitted writes and behavior for missing values. Ask for a read-only proposal first. Use fictional sample records and remove personal data and credentials before sharing a schema or error message with an outside service. A generated script still needs someone who understands which records it can change.
I would reject a draft that deletes duplicates on the strength of a repeated name, clears a field when a value is unknown, or retries an external creation without checking whether it already succeeded. Those are decisions about your records. Review them before debating shorter syntax.
Before adapting code, use the Airtable scripting reference for the environment you're targeting; the extension also includes an in-app reference. Return to one changed record in the copied base. Confirm that the intended field changed, its linked facts stayed in their own tables, and the log explains what a second run would do. Keep that result beside the rule's owner in your automation workflow.
