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.