Skip to main content
Tablix includes a full Python code editor and execution engine that runs entirely in your browser — no server round-trip needed to execute your code (only the AI code-generation step calls out to the AI service).

Opening the Python Editor

Open the code editor sidebar and choose Python as the language (you can switch between Python and SQL). It’s a Monaco-based editor (the same engine behind VS Code), with:
  • Syntax highlighting and autocomplete (keywords, built-ins, pandas/numpy/scikit-learn/scipy import snippets, and your sheet’s actual column headers as suggestions)
  • Inline error markers pointing at the failing line
  • A resizable console panel showing print() output, tables, and errors
  • Dark mode toggle
  • An AI prompt box inside the editor so you can ask the AI to write the code for you without leaving the editor
  • A prompt “optimizer” that rewrites a rough request into a more precise technical instruction before generating code

Execution Engine

Python code runs via Pyodide (CPython compiled to WebAssembly) in a background Web Worker, so it doesn’t freeze the UI.
Available libraries: pandas (as pd), numpy (as np), scikit-learn (sklearn), scipy.Other libraries (e.g. matplotlib, seaborn) are not available — charts are created via the create_chart() bridge function instead. See Charts.

Reading Your Sheet: q.cells()

q.cells() automatically loads the requested range from the active sheet into a pandas DataFrame, using the first row of the range as column headers.

Writing Back to the Sheet

Depending on what you’re doing, use the matching bridge function rather than one big generic “set everything” call:
is_equal_to, is_not_equal_to, text_contains, greater_than, less_than, greater_than_or_equal, less_than_or_equal, is_empty, is_not_empty, text_starts_with, text_ends_with, values (for matching a list of values).

Text Output

Use print() for explanations, summaries, or “Key Insights” style analysis instead of set_data() — this shows up in the console/chat as text rather than writing a new table to the sheet.

Creating Charts with create_chart()

Use create_chart() to build a chart directly from your Python code and place it on the sheet — no matplotlib/seaborn needed (those libraries aren’t available).
chart_type accepts any of Tablix’s chart types — 'line', 'area', 'column', 'bar', 'pie', 'doughnut', 'scatter', 'radar', 'waterfall', 'funnel', 'combo', 'histogram', and more. See the full list at Charts → Chart Types.

Option 1 — Chart Existing Columns

Point it at columns already on your sheet and let it aggregate for you:
This groups every row by Region, sums Sales per group, and charts the result — no need to pre-aggregate with pandas first. Multiple value columns become multiple series:
Only the top or bottom N, or specific categories:

Option 2 — Chart Data You’ve Already Computed

If you’ve already calculated the numbers yourself (e.g. with pandas.groupby, or values that don’t map to raw columns), pass them directly with labels and values:
Multiple series — pass a list of lists for values, with matching series_names:
Use either label_col/value_cols or labels/values — don’t mix the two in one call. Placement on the sheet and chart colors are both handled automatically; you don’t need to set a position or pick colors yourself.
You don’t have to write any of this by hand — describing the chart you want to the AI Assistant generates the right create_chart() call for you. See Charts → Creating a Chart with AI for prompt examples.

AI-Generated Python

You don’t have to write Python yourself — describe what you want in the AI Assistant sidebar or the in-editor AI prompt box, and the AI generates the appropriate code using the bridge functions above, then runs it automatically.
See Error Handling for a full list of Python error messages and what causes them.