How to share a Google Colab notebook
Colab's share button is a Google Drive share button. Everything confusing about sharing a Colab notebook follows from that one fact.
What the share dialog is actually doing
The notebook is an .ipynb file in your Drive. The dialog sets Drive
permissions on it:
- Named people or groups. They open it in Colab with their own Google account and their own runtime.
- Anyone with the link. World-readable. Anyone who receives or finds the URL opens the notebook, including whatever is in the saved outputs — API responses, sample rows from a customer table, a stack trace with a hostname in it. This is publishing.
Either way, the reader needs a Google account, and the reader gets a notebook — code cells, a Run button, and the invitation to execute it. That is right for a collaborator and wrong for a reviewer.
The two things that surprise people
The runtime is not shared. Colab shares the file, not the VM. Two people open the same notebook and get two separate runtimes with separate state. If your reader hits "Run all," they need the data to be reachable from their session — which, if it lives in your Drive or behind your credentials, it is not.
Outputs are whatever you last saved. They live in the .ipynb. Clear
outputs before saving, or save mid-run, and the reader opens a notebook full
of empty cells and concludes it is broken. Colab's own settings can strip
outputs on save; check that before wondering where the charts went.
When the reader is not a collaborator
Most sharing requests are not "help me edit this." They are "show me what you found." For that reader, the code cells are noise, the runtime is irrelevant, and the Google account requirement is a barrier for no benefit.
Export an executed HTML copy instead. From inside the notebook:
!jupyter nbconvert --to html --execute --no-input \
/content/drive/MyDrive/Colab\ Notebooks/analysis.ipynb \
--output /content/report.html
--execute re-runs it so the outputs are current, --no-input drops the code
so it reads as a document. Then publish that file to a stable URL:
import requests, os
html = open("/content/report.html").read()
r = requests.patch(
f"https://commareports.com/api/v1/reports/{os.environ['REPORT_ID']}",
headers={"Authorization": f"Bearer {os.environ['COMMA_API_TOKEN']}"},
json={"title": "Churn analysis — March", "html": html},
)
r.raise_for_status()
Store the token as a Colab secret rather than pasting it into a cell — a notebook you are about to share is the last place to hardcode a credential, and a scoped token limits the blast radius if it leaks anyway.
What the reader gets
A URL that opens in any browser with no Google account, no runtime, no Run button. Charts stay interactive if they are Plotly, Bokeh, Altair or folium — that behaviour is client-side JavaScript, so it survives the export as long as the library is embedded rather than linked to a CDN.
Access is a setting on the report — private, team, domain-gated or link — so "anyone at my company" is a real option instead of world-readable-or-invite-list.
And there is somewhere to put the discussion. A reviewer highlights the regression table and pins "this drops the two outlier accounts, worth stating in the writeup." That thread stays attached as you re-run and PATCH new revisions, which is the part a Drive share has never had — Colab comments attach to cells that move, and they disappear entirely from any export.
When to just share the notebook
Share the Colab link when the other person is going to edit — a co-author, a student, someone debugging with you. Colab is very good at that, and no exported document replaces a live runtime for collaboration. Publish an export when the audience is reading, reviewing, or approving, which is most of the time.
Try it
Comma is free — unlimited reports, unlimited commenters, unlimited revision history.