> This page is for Glide Classic.

> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://www.glideapps.com/docs/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://www.glideapps.com/docs/_mcp/server.

# 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](https://www.glideapps.com/contact/business) 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

> **Warning**
>
> Glide provides a [JS Code Sandbox](https://github.com/glideapps/code-sandbox-playground) 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.

#### JavaScript Function: In the Data Editor

In the [Data Editor](/docs/getting-started/introduction-to-the-data-editor), click the plus symbol to add a new column.

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

Enter the JavaScript code in the **Function Code** field.

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

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

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.

#### Layout Editor

#### Run Javascript Code: In the Layout Editor

In the [Data Editor](/docs/getting-started/introduction-to-the-data-editor), create columns to store the **Result** and optionally the **Log Output URL**.

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

Click the [Action](/docs/automation/actions) dropdown and navigate to **Integrations → Run Javascript Code**, then select **Run Javascript Code**.

Enter the JavaScript code in the **Function Code** field.

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

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

`process.env` variables in the code.

Select a **Result** column to store the returned value.

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

#### Workflow Editor

#### JavaScript Code: In the Workflow Editor

In the [Data Editor](/docs/getting-started/introduction-to-the-data-editor), create columns to store the **Result** and optionally the **Log Output URL**.

In the [Workflows](/docs/automation/workflows) tab, create or edit a workflow.

Click the plus symbol to add an action.

Search for "Javascript" and select **Run Javascript Code**.

Enter the JavaScript code in the **Function Code** field.

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

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

Expand the **Results** section to map output values to your columns or use them in subsequent workflow steps.

To learn more generally about Integrations in Glide, including how they affect app usage, check out the [Introduction to Integrations](/docs/automation/integrations).

## Frequently Asked Questions

#### Which plans include JavaScript Code?

JavaScript Code is an add-on for Enterprise plans. [Contact sales](https://www.glideapps.com/contact/business) to get started.

#### How many updates does JavaScript Code use?

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.

#### What is the difference between the computed column and the action?

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.