# Charts, tables and .ipynb export

**Categories:** Using AI

---

A notebook draws charts and tables from the results of its code, and every chart says where its data came from. You can open any result in a grid, chart it, and save it, and you can move a whole notebook in and out of Jupyter. This page covers charts, tables, the result grid, and import and export. For the cells themselves, see [Notebooks: cells, Run and outputs](https://retainapp.ai/help/article/notebooks).



### How a chart is drawn



A chart cell holds a Vega-Lite chart that points at a result by name, for example #by_team. A Python cell can also produce a chart of its own. Python draws the chart on your Mac, in light and dark, scaled to the notebook's width, with a readout under the pointer that shows values at the nearest point. Its caption names the data it came from and what produced it.



When a chart cannot be drawn, it says why and offers the fix:



* Run the cell that makes its data, with a Run button.
* The data's cell was deleted, with Restore cell.
* A field it uses is gone, so the chart is stale.
* Updating, while a newer drawing is on its way, or Out of date, when a run will replace it.
* A Vega error, shown in place.

A chart draws a result, not a whole file. To chart an attached file, query it in a SQL cell and chart that result.



### Tables



A table a cell prints shows as a table of up to 200 rows, with a count of rows shown. A data cell collapses to one line with its row count and source, and opens to its table. iPhone shows the first 50 rows of a table.



### The result grid



When a code cell produces a table, its row count appears in the gutter. Click it to open the result in a grid.



* Sort by a column from its header: ascending, descending, or off.
* Filter by a column with contains, equals, not equals, less than, greater than, is empty or is not empty.
* Select rows with Shift and Cmd, and choose Copy as TSV for the selected rows, or for every row shown.
* Choose Export, then CSV or Parquet, to save every row of the result where you choose.
* Choose Chart this to add a chart cell below the cell that draws the result.

The grid works on the stored preview of 200 rows. When a result has more, it says "the first 200 of N", and sorting and filtering apply to those rows. An export has every row.



### Export and import



Open the "..." menu on a notebook for two exports:



* **Export .ipynb.** Saves the notebook as a Jupyter file with its latest outputs.
* **Copy as Markdown.** Copies the notebook's text, with its code and data as fenced blocks.

To bring a notebook in, choose File, Import, Jupyter Notebook and pick an .ipynb file. Its cells and outputs become a new notebook. Kinds, order, collapsed state and outputs round-trip. Retain's own kinds, such as SQL, math, data and chart, appear in Jupyter as cells it can show, and their details are kept so they return intact. Imported outputs show as from a previous session until you run them. A file attached to a notebook is referenced in the export, not embedded.
