Hirsthals coasl road

How to save a Google Colab Notebook as HTML

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.



Posted

in

, , ,

by

Comments

2 responses to “How to save a Google Colab Notebook as HTML”

  1. Daniel Avatar
    Daniel

    Hi Torbjorn, it was nice to read the colab post, could you check on iframes? I could not vidualize them it shows message “couldn be displayed or doesnt have access”.

    Thank you a lot

    1. Torbjorn Zetterlund Avatar
      Torbjorn Zetterlund

      I’m looking into it thanks for pointing it out. You can access the notebook on colab here – https://colab.research.google.com/drive/13hj4spV43lEB_bSTGuGqzBl3G9cWgVEV should be set for anyone on internet. I hope that helps, tills I figured the rest out about permissions.

Leave a Reply to Torbjorn Zetterlund Cancel reply

Your email address will not be published. Required fields are marked *