Share a Colab notebook as HTML
Colab's share button shares a runtime. That's exactly right when the other person is going to run the thing, and exactly wrong when they're going to read it. A stakeholder opening a shared Colab link gets a Google sign-in, a code cell at the top of the document, a "Run all" button, and the standing possibility of changing the numbers they were asked to review.
What that reader wants is the output: charts, tables, the narrative between them. That's a static export — and the export is one line.
Export and publish, from inside the notebook
!jupyter nbconvert --to html --no-input /content/notebook.ipynb
import os, requests
requests.patch(
f"https://commareports.com/api/v1/reports/{os.environ['COMMA_REPORT_ID']}",
headers={"Authorization": f"Bearer {os.environ['COMMA_API_TOKEN']}"},
json={
"title": "Weekly analysis",
"html": open("/content/notebook.html").read(),
},
timeout=30,
)
--no-input drops the code cells and keeps the outputs and markdown —
the audience-facing document. Drop the flag when the audience is
technical; many teams keep both, as two reports with two URLs.
Put the token in Colab's Secrets panel (userdata.get("COMMA_API_TOKEN")),
not in a cell. Use a scoped token with reports:write
so a leaked notebook can't do anything else.
PATCH on a saved report id gives one URL with a revision per run, so
last month's link opens this month's analysis and the two can be
diffed.
What the published version gives you
- Frozen outputs. Nobody re-runs the analysis by accident, and what a reviewer saw is what a revision recorded.
- Comments on a chart. Pinned to the figure, not floating in a thread — see commenting on HTML. The reader needs no Google account.
- Interactive plots survive. Plotly and Altair figures exported into the HTML keep working inside the sandbox — see interactive HTML reports.
- Access you control. Private, team-visible, domain-gated, or named reviewers. See the sharing model.
Limits
- HTML body: 5 MB. A notebook with many inline images passes it — downsample figures, or attach the heavy ones as assets.
- Scripts run, sandboxed:
allow-scripts, noallow-same-origin.
Try it
Comma is free — unlimited reports, unlimited commenters, unlimited revision history.
Related
- Jupyter notebooks — nbviewer alternative, in detail
- R Markdown · EDA reports
- Google Docs for HTML