Torbjorn Zetterlund

Fri 03 2019
Image

How to save a Google Colab Notebook as HTML

by bernt & torsten

I have been doing a lot of work with creating Jupyter notebooks and collaborating with the Google Colab service, Colaboratory or short-form Colab is a free Jupyter notebook environment that requires no setup and runs entirely in the cloud.

With Colab you can write and execute code, save and share your analyses, and access powerful computing resources, all for free from your browser.

I have been looking at ways to include my notebooks in my WordPress site, as a way to show some of the work and help others that getting started. With WordPress you can add HTML code, the obvious choice would have been to save my Colab notebooks as HTML.

Colab at the moment does not have an option to save your Colab notebook to HTML, Jupyter Notebook has an option to ‘Download as’ HTML (or other) format.

I do all my data science work using Google Colab, a notebook is a great way to tell a story and to test out different analytics technics on your dataset. Before you get to the point of doing a dashboard or in my case adding the code functionality into a web app. There is a workaround to the missing feature in Colab to save to HTML. Here it is.

  1. Save your Colab notebook.
  2. File > Download .ipynb
  3. On your terminal:
    jupyter nbconvert --to <output format> <filename.ipynb> or alternatvie
  4. jupyter nbconvert <filename.ipynb> --to html

For more information on nbconverthttps://github.com/jupyter/nbconvert

Below is an example of a Jupyter notebook that I have been working on for teaching people how to use the Jupyter notebook.


Share: