Thought leadership from the most innovative tech companies, all in one place.

How to Convert a Google Colab (.ipynb) Notebook to HTML

Often, we need to share our code explanations and figures written in a Google colab Jupyter notebook (.py or .ipynb files) with our friends/colleagues/bosses. The simple way is to save them as PDF files. However, PDF files are unable to load large figures or the markdown explanations.

An alternative way is by sharing them as .html files as it’s simple in just a click away of opening the notebook, without having Python installed or colab environment.

Below are the step-by-step method on how to export your Google colab Jupyter notebook as an HTML file.

1. Download your colab notebook, at the top right, click File → Download → Download .ipynb

image

2. Re-upload the downloaded .ipynb to the session storage.

You will have .ipynb file in your session storage (as marked with a blue arrow).

image

3. Run the below script and click the refresh icon under Files.

%%shell
jupyter nbconvert --to html //Your notebook path file.ipynb

You will see your notebook as .html (as marked with a blue arrow).

image

4. Click the three dots next to your .html file and download. Your file is ready to be share!

Reference from StackOverflow

Feel free to comment/ask ! Happy learning :)




Continue Learning