现已上市.ipynb

Word 转 Jupyter Notebook

上传.docx 获得有效的.ipynb:Word 标题与段落变为 Markdown 单元格,带格式的代码变为围栏代码块,表格与可选内嵌图片——全部在浏览器本地完成。

Free and instant. Files are processed briefly on our servers for conversion, then discarded — nothing is stored.

它是如何运作的

从上传到下载三步

1

放下你的笔记本

将.ipynb 拖到卡上或浏览您的文件。您永远不会创建帐户。

2

选择导出

选择 Word、PDF、Markdown、HTML、LaTeX、ZIP、Python 工具、查看器、清理器、合并器或拆分器 - 任何与您的审阅者匹配的工具。

3

下载并发货

立即获取完成的文件。在本地打开它,将其附加到电子邮件中,或上传到您的 LMS。

为什么要把 Word 文档转换成 Jupyter Notebook?

如果你曾提交过数据科学作业、批改过学生的分析报告,或与习惯用 Microsoft Word 的同事协作而你自己常驻 Jupyter,你一定深知格式鸿沟有多令人抓狂。

Word 文档无处不在。真正跑分析的是 Jupyter Notebook。

问题一再出现:学生在 Word 里写,课程却要求提交 .ipynb;数据科学家在 Word 里写方法论文本,又需要可执行的代码单元格;研究者在 Word 里起草报告,想在不推倒重来的前提下加入可运行的 Python 可视化。

正因如此才有这个转换器。拖入 Word 文档(.docx),得到结构清晰的 Jupyter Notebook(.ipynb)——正文在 Markdown 单元格,代码块在可执行代码单元格,标题映射到一致的 Markdown 层级。无需复制粘贴。无需重新排版。也不必因为难缠的命令行而牺牲周末。

转换如何一步步发生

Word 转 Jupyter 不是魔法,而是结构化文本的翻译。.docx 本质上是 XML 包;笔记本是 JSON。转换器读取结构,把每个元素映射到合适的单元类型,并写出 JupyterLab、VS Code 与 Google Colab 都能原生打开的合法 .ipynb。

上传文件时会发生:

  1. 1

    解析 Word 文档结构

    工具读取 .docx,识别段落、标题(H1–H6)、代码样式块、表格、列表与嵌入图片,并保持原有顺序。

  2. 2

    将内容映射到单元类型

    段落与标题成为 Markdown 单元格。等宽或标记为代码的段落成为代码单元格。启用 GFM 表格时,表格会成为 Markdown 单元格内的 Markdown 表格。

  3. 3

    构建 .ipynb JSON

    转换器组装合法的 nbformat 4.5 结构——与 JupyterLab、VS Code、Colab 期望一致。元数据、内核提示与单元 ID 会自动生成。

  4. 4

    预览并下载

    数秒内即可得到 .ipynb。转换在浏览器本地完成:.docx 不会上传到我们的服务器,内容在下载前始终保留在此标签页,保持私密。

把 Word 转成 Jupyter Notebook 的三种方式

每个人的流程不同。页面介绍三种互补路径——浏览器里快速完成、用 Pandoc 可重复执行,或用 Python 完全可编程。

最简单 — 无需安装

使用此在线转换器

上传 .docx,预览单元格,下载 .ipynb。现代浏览器即可,无需 Pandoc、Python 或终端,适合一次性转换。

开发者 — 命令行

在终端使用 Pandoc

安装 Pandoc 后运行 pandoc file.docx -o file.ipynb,适合自动化与离线批处理。

Python — 脚本化

python-docx + nbformat

用 python-docx 读取段落,按自定义规则用 nbformat 组装单元格。

进阶用户 — 批量

批量转换整个文件夹

用简短的 Pandoc shell 循环或 Python subprocess 一次处理整个 .docx 目录。

用 Pandoc 将 .docx 转为 .ipynb(命令行)

Pandoc 是文档转换的事实标准。自 2.11 起原生支持 docx → ipynb。安装后通常一条命令即可:

pandoc my-report.docx -o my-notebook.ipynb
for f in *.docx; do pandoc "$f" -o "${f%.docx}.ipynb"; done

Pandoc 会把 Word 标题样式映射为 Markdown 标题(#、##)并放在 Markdown 单元格中,把段落映射为 Markdown,把代码样式文本映射为代码单元格——结构保真且完全在本地离线运行。

用 Python 将 .docx 转为 .ipynb

若需要程序级控制——例如按关键词把段落变成代码单元格——请使用 python-docx 与 nbformat。

编写短脚本遍历段落,在 Markdown 与代码之间做判断,并向 notebook 对象追加单元格,即可得到完全可定制的流水线。

pip install python-docx nbformat

谁真的需要 Word 转 Jupyter?

这种需求比你想象的更常见,例如:

提交作业的学生

Word 起草、Jupyter 批改——最常见场景。

追求可复现的研究人员

Word 中的方法论章节变成审稿人可实际运行的笔记本。

迁移文档的数据团队

技术类 Word 文档进入 Git 中可交互、可版本化的笔记本。

编写课程材料的教师

Word 讲义变成可在 Colab 或 Binder 打开的交互笔记本。

工具链混杂的团队

非技术同事留在 Word;工程侧需要在流水线里使用 .ipynb。

归档与数字化

旧版 Word 分析报告变成可在新数据上重新执行的笔记本。

获得更好转换效果的提示

  • ✓使用内置标题样式(标题 1/2)——会映射为 # / ## 并形成清晰结构。
  • ✓用等宽字体或「代码」段落样式标记代码,以生成可执行单元格。
  • ✓避免浮动文本框与复杂多栏版式——它们会被不可预测地压平为 Markdown。
  • ✓图片尽量简单;行内嵌入通常效果最好。
  • ✓转换前先检查拼写——文本会原样保留。
  • ✓转换后在 JupyterLab 打开 .ipynb 并运行「Run All Cells」验证代码单元格。

方法对比:该选哪一种?

方法速度无需安装离线批量代码单元格识别
此浏览器转换器即时✓✗✗自动
Pandoc CLI快✗✓✓自动
python-docx + nbformat中等✗✓✓自定义
手动复制粘贴慢✓✓✗手动

.ipynb 文件是什么?

.ipynb 按 nbformat 以 JSON 存储单元格(Markdown 或代码)、可选输出与元数据。JupyterLab、VS Code、Colab 与 Databricks 都支持该格式。

从 Word 转换旨在保留意图:叙述与可运行片段、表格与正文、图片的位置。

在线将 Word 转为 Jupyter Notebook

Students, researchers, and teams draft in Microsoft Word but need a valid .ipynb for JupyterLab, VS Code, or Google Colab. This page is the reverse of our IPYNB to DOCX export: take a .docx hand-in, lecture note, or methodology draft and rebuild notebook cells you can run. Secure server conversion — processed briefly, not stored afterward. Upload a .docx, preview how headings and code styles map to cells, and download nbformat 4.5 JSON with cell IDs included.

We map Word through structured HTML to Markdown, then reuse the same fence-aware pipeline as Markdown to Jupyter so fenced blocks become code cells and narrative stays in Markdown cells. Real Heading 1–6 styles become Markdown # hierarchy; monospace fonts or Word “Code” paragraph styles are preferred signals for executable cells instead of prose. Optional GFM tables keep lab tables inside Markdown cells; optional inline images carry diagrams as data URLs when you need figures in the notebook.

Legacy binary .doc files are not supported—open them in Word or LibreOffice and save as .docx first. Complex floating text boxes and multi-column layouts flatten because notebooks do not have those constructs; keep content linear for best results. We never execute your Python—language tags and style hints only steer kernelspec metadata so Colab and Jupyter open the file cleanly. After download, Run all and fix any fences that Word styled inconsistently.

Use this when a classmate wrote analysis in Word for a course that requires .ipynb, when an instructor distributed .docx notes that should become a lab, or when you edited a notebook in Word via DOCX export and need the interactive format back. Pandoc remains excellent for CLI batches (pandoc file.docx -o file.ipynb); this page is the zero-install path with live preview for one-off Word → notebook conversions without maintaining python-docx scripts on a shared PC. After conversion, skim the preview for misplaced code cells; Word bold-only fake headings without real styles often need a quick fix before you rely on the outline in Jupyter.

高级 Word → 笔记本功能

样式感知的代码检测

可选样式映射将 Word「代码」或等宽段落处理为 fenced code,使其进入可执行单元格而非 Markdown 正文。

GFM 表格与列表

带 GFM 的 Turndown 保留表格、任务列表与强调,让讲义顺利进入笔记本。

内联图片(可选)

开启嵌入可将示意图以 data URL 放入 Markdown 单元格——实验课很实用;可能增大文件。

不执行的内核提示

我们不运行您的 Python;围栏上的语言标签仍会像 Markdown 导入一样引导 kernelspec 元数据。

与 IPYNB 转 DOCX 配套

在 Word 中编辑后需要再次获得交互格式且不想安装 Pandoc 时的往返流程。

nbformat 4.5 输出

下载文件可在 JupyterLab、VS Code、Colab 等兼容工具中打开,并包含单元格 ID。

FAQ

常见问题

Secure server conversion — processed briefly, not stored afterward. Clear the tab when finished on a shared PC.

Only modern Office Open XML (.docx) is supported. Open legacy.doc in Word or LibreOffice and save as.docx, then convert here.

Pandoc is excellent for CLI automation. This page is for zero-install, in-browser workflows with live preview and download.

With "GFM tables" enabled, HTML tables from Word typically become Markdown tables inside Markdown cells.

Yes. Colab accepts standard.ipynb files—upload the file from the Colab file panel or Drive.

Word styling is approximated. Review runnable cells after conversion and adjust kernels or fences as needed.

Yes. Export notebooks to Word for track-changes review, then convert the .docx back here when you need runnable cells again. Round-trips are structural, not pixel-perfect—review code cells after import.

Use a monospace font or a Code paragraph style, or wrap samples in clear fenced-style blocks after HTML conversion. Heading styles should be real Word headings, not bold-only fake titles.

Yes. Heading 1–6 map to Markdown heading levels inside Markdown cells so the notebook outline matches the document.

No. It only builds notebook structure. Open the .ipynb in Jupyter, VS Code, or Colab and run cells yourself in a trusted environment.

Yes. Download the .ipynb and upload it in Colab’s file panel or Drive. Adjust the kernel if needed, then Run all to verify fences became executable cells.

Simple equations and footnotes may flatten to Markdown or plain text. Complex equation editors and endnotes often need a quick manual pass after conversion.