Skip to content

How to export a notebook in HTML

YY Ahn edited this page May 13, 2024 · 6 revisions

Local

If you are using jupyter notebook (or jupyter lab) locally on your system, follow these simple steps:

  1. Simply download the file in .html format.
    • File -> Download as -> HTML (.html)

Google Colab

If you are using Google Colab, follow these steps to export your notebook to HTML format. First, you want to download the colab notebook as an ipynb file to your local computer.

  1. Download the .ipynb file to your desired location.
    • File -> Download -> Download .ipynb

Then, you want to use nbconvert tool (https://nbconvert.readthedocs.io/en/latest/) that allows you to convert a Jupyter notebook file to various other formats. Install it, and then run

$ jupyter nbconvert --to html filename.ipynb

If you are using a conda environment,

$ conda activate env_name
$ conda install nbconvert
$ jupyter nbconvert --to html filename.ipynb

With pip, if you have your virtual environment in dataviz/.venv directory and you downloaded the notebook file as dataviz/notebook.ipynb.

$ source .venv/bin/activate  # activate virtual env
$ pip install nbconvert
$ jupyter nbconvert --to html notebook.ipynb