JavaScript Code

Execute custom JavaScript to transform data, perform calculations, and connect to external APIs.

JavaScript Code runs custom JavaScript in Glide apps. With it, you can transform data, perform calculations, or connect to external APIs. The feature is available as the JavaScript Function computed column and the Run JavaScript Code action.

Enterprise Feature

This feature is available as an add-on to Enterprise plans. Contact sales to get started.

Writing the JavaScript Code

JavaScript Code requires a function named run that takes a JSON object as input and returns a JSON object as output.

export async function run(input) {
// Your logic here
return {
result: "your output"
};
}

The following packages are available for use in the code:

  • lodash — Utility library for data manipulation
  • date-fns — Date formatting and calculations
  • ms — Convert time strings to milliseconds
  • uuid — Generate unique identifiers
  • fast-deep-equal — Deep equality comparison

Using a coding agent

Glide provides a JS Code Sandbox environment designed for use with coding agents.

A coding agent such as Claude Code can generate the JavaScript code for you based on a description of the desired functionality. This allows you to generate the code by describing the requirements with a prompt, and the agent you choose generates the code in code.js. You can then copy the code into the Function Code field in Glide.

JavaScript Function Computed Column

The JavaScript Function computed column executes code for each row in a table and returns the result as a dynamic value.

1

In the Data Editor, click the plus symbol to add a new column.

2

Navigate to Integrations → Run Javascript Code and select JavaScript Function.

3

Enter the JavaScript code in the Function Code field.

4

Add Input values by clicking + Add value to pass data from the row as key-value pairs.

5

Add Secrets like API keys by clicking + Add value to pass sensitive values securely—these map to process.env variables in the code.

6

Click Done.

Run Javascript Code Action

The Run Javascript Code action executes JavaScript in response to user interactions or workflow triggers. Unlike the computed column, this action includes a Log Output URL field that captures console.log() output for debugging.

1

In the Data Editor, create columns to store the Result and optionally the Log Output URL.

2

Select a component that supports actions (such as a Button).

3

Click the Action dropdown and navigate to Integrations → Run Javascript Code, then select Run Javascript Code.

4

Enter the JavaScript code in the Function Code field.

5

Add Input values by clicking + Add value to pass data as key-value pairs.

6

Add Secrets like API keys by clicking + Add value to pass sensitive values securely—these map to

7

process.env variables in the code.

8

Select a Result column to store the returned value.

9

Optionally, select a Log Output URL column to store a link to the console output for debugging.

Frequently Asked Questions

JavaScript Code is an add-on for Enterprise plans. Contact sales to get started.

JavaScript Code uses 1 update each time it runs. When used as a computed column in the Data Editor, it uses an update for every row where it runs.

The JavaScript Function computed column runs for each row and returns a value. The Run Javascript Code action runs on demand (via button click or workflow) and includes a Log Output URL for debugging.