> For the complete documentation index, see [llms.txt](https://docs.papers.ai/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.papers.ai/notebooks-and-data/notebooks.md).

# Notebooks

Notebooks (`.ipynb` files) mix code and markdown cells in one document. Code runs entirely in your browser (Python via Pyodide, R via WebR), so there's no server or separate runtime to set up.

## Create and structure a notebook

{% stepper %}
{% step %}

### Create the file

Create a new file with a `.ipynb` extension, or add one from the **Add files** screen when creating a project.
{% endstep %}

{% step %}

### Add cells

Add cells with **Add cell**, choosing **Code** or **Markdown** for each. Use markdown cells for headings and explanations, and code cells for executable steps.
{% endstep %}

{% step %}

### Reorder and save

Drag cells to reorder them, then save. The cell order, types, and content persist when you reopen the file.
{% endstep %}
{% endstepper %}

## Run cells and read outputs

* Run a single cell with its per-cell run control, or use **Run cell & advance** to run it and move to the next cell.
* Use **Run all cells** to execute the whole notebook top-to-bottom.
* Each cell shows its output underneath (text, a table, a plot, or an error) along with an execution count.
* If a cell hangs or a variable seems out of sync, use **Stop execution**, **Restart kernel**, or **Restart and run all** from the notebook toolbar.

{% hint style="info" %}
Useful shortcuts: `Shift+Enter` runs the current cell and advances; `Mod+Enter` runs it in place; `Mod+Shift+Enter` runs the whole notebook.
{% endhint %}

## Things to know

* Supported languages are Python and R.
* The kernel needs a few seconds to start on first use. Running a cell while it's still starting queues the request rather than failing.
* Restarting the kernel clears all variables. Rerun your setup cells afterwards.
* Runtime state (variables, outputs) is saved between sessions, but a hard refresh or a storage error can reset it. Rerun your setup cells if that happens.
* Code you run, including code the AI runs on your behalf, can write files directly into your project, like a `.csv` or image output. Unlike edits the AI proposes elsewhere, these writes aren't staged for review; they happen immediately, the same as if you'd run the code yourself. See [Reviewing AI changes](/using-ai/reviewing-ai-changes.md).

{% hint style="success" %}
The AI can see your notebook like any other file. Attach it and ask for help writing a cell, explaining an error in the output, or summarizing what a block of code does. See [Using AI](/using-ai/using-ai.md).
{% endhint %}

## Troubleshooting

<details>

<summary>A cell won't run</summary>

Check whether another cell is still executing, or restart the kernel and try again.

</details>

<details>

<summary>Outputs look stale or out of order</summary>

Use **Run all cells** to rebuild state from the top.

</details>

<details>

<summary>Import or module errors</summary>

Check that any packages you rely on installed successfully. See the package manager in the notebook toolbar.

</details>

<details>

<summary>The notebook won't open</summary>

Confirm the file is valid `.ipynb` JSON. An empty or corrupted file reopens as a fresh starter notebook.

</details>

## Next steps

* [Data files](/notebooks-and-data/data-files.md)
* [Quickstart](/getting-started/quickstart.md)
* [Core concepts](/getting-started/core-concepts.md)
* [Using AI](/using-ai/using-ai.md)
