The Scripting Editor in GridScript lets you write and execute code directly on your datasets. You can transform data, automate logic, or even create charts — all without leaving your workspace.
GridScript runs JavaScript inside a secure sandbox and exposes a simple API to interact with the dataset and the UI. Within your script, the following globals are available:
gridData – A 2D array representing the current dataset.updateGridData(newData) – Updates the grid with modified data.addChart(options) – Creates and inserts a chart in the project UI.for (let i = 1; i < gridData.length; i++) {
gridData[i][0] = "Row " + i;
}
updateGridData([...gridData]);The addChart() function allows you to generate charts programmatically by passing a configuration object compatible with the AgCharts React ChartOptions interface. This gives you complete control over chart type, data, axes, titles, and series.
addChart({
title: { text: "Sales by Region" },
data: gridData.slice(1).map(row => ({
region: row[0],
sales: Number(row[1]),
})),
series: [{
type: "bar",
xKey: "region",
yKey: "sales",
}],
axes: [
{ type: "category", position: "bottom", title: { text: "Region" } },
{ type: "number", position: "left", title: { text: "Sales ($)" } },
],
legend: { enabled: true },
});The addChart() function fully supports the AgCharts configuration model. You can customize everything from color themes to animation settings and event handling by passing a standard ChartOptions object.
➤ For a complete list of available options, refer to the official AgCharts ChartOptions documentation.
addChart() supports all visualization types available in AgCharts, including:
bar – Compare categorical values.line – Visualize trends and progressions.area – Show accumulated values over time.scatter – Highlight relationships between variables.bubble – Add a third variable represented by bubble size.pie / donut – Display proportions of a whole.GridScript also supports Python. This allows you to run Python code directly in the browser, using the same grid_data structure. Unlike JavaScript, you don’t need to call updateGridData() — the environment automatically syncs your changes.
for row in grid_data:
row[1] = float(row[1]) * 2Python scripting is perfect for users familiar with data science workflows, offering an intuitive way to manipulate datasets using Pythonic syntax.
If your script throws an error, GridScript will display a descriptive message in the editor panel. Errors don’t modify your grid, ensuring your data stays safe while you debug.
Scripts are stored as part of your Project. You can re-run them, modify them inline, or export them together with your data in a.gspj file.
Learn how to create and customize visualizations in GridScript.
See how to import data or share your results with others.