文件格式任意转换助手Transfer Any File

离线 · 无上传 · 浏览器本地完成Offline · no uploads · runs in the browser

Markdown 表格转 Excel——离线、按写下的字符落地、不上传Markdown table to Excel offline — values kept, no upload

四步的链:Markdown 按 GFM 渲染成 HTML(表格是管道符语法,表头行渲染成 `<thead>` 里的 `<th>`),从 HTML 里按「首行给键名、每行一个对象」取出 JSON,再把 JSON 摊成 CSV(列取所有记录键名的并集),最后由 CSV 写进工作表。真正决定产物形态的是最后一步:读取用的是 `raw: true`,SheetJS 的类型推断器因此完全碰不到数据,`00424` 不会缩成 `424`、`2024-01-05` 不会变成序列号 `45296.33…`、`1/2` 不会变成 2001 年 1 月 2 日;随后只有一道规则把该是数字的格子还回去——十进制形状、`String(Number(x)) === x` 逐字节回得来、且有效数字不超过 15 位。16 位以上刻意留在文本,因为 Excel 只渲染 15 位有效数字,`4111111111111111` 变成数字后打开就是 `4.11111111111111E+15`,那是同一件事晚一步发生。仍是文本的格子再套一层公式护栏,并把数字格式钉成文本——写出的 `xl/styles.xml` 里,那一格用的就是内置格式号 49。上一步 CSV 写的 UTF-8 BOM 在这一步解码时被 TextDecoder 剥掉,所以第一个表头不会带上不可见的 U+FEFF。全程离线,四步都在这个标签页里。A four-step chain: the Markdown renders to HTML as GFM (the pipe table’s header row renders as `<th>` inside `<thead>`), JSON is lifted out of that HTML by “first row names the keys, every later row is one object”, the JSON is spread into CSV (columns are the union of every record’s keys), and the CSV is written into a worksheet. The last step is where the artifact’s shape is decided. It reads with `raw: true`, so SheetJS’s type inferrer never touches the data: `00424` does not shrink to `424`, `2024-01-05` does not become the serial `45296.33…`, and `1/2` does not become 2 January 2001. One rule then gives back the number type where it truly was one — decimal shape, `String(Number(x)) === x` returning the exact characters, and at most 15 significant digits. Sixteen and above deliberately stay text, because Excel renders only 15 significant digits and `4111111111111111` opens as `4.11111111111111E+15` once it is a number: the same loss, one step later. Cells still holding text then get the formula guard and a pinned text number format — in the written `xl/styles.xml` that cell carries the built-in format id 49. The UTF-8 BOM the CSV step wrote is stripped by TextDecoder while reading, so the first header never carries an invisible U+FEFF. All four steps run in this tab, offline.

一批转换结果卡片,含文件名、体积与下载入口
一次混合批量,一个 ZIP 下载One mixed batch, one ZIP download

这条链路怎么走How the route runs

MarkdownMarkdown HTMLHTML JSONJSON CSVCSV Excel (.xlsx)Excel (.xlsx)

共 4 步,由扩展的路径搜索自动选出,中间产物不落盘。4 steps, chosen by the extension's own path search; intermediate results never touch the disk.

会保留什么What carries over

  • 表头行成为工作表第一行,每条数据行一行;产物只有一张工作表,表名沿用读取那份 CSV 时得到的名字,而不是这一步新造的The header row becomes the worksheet’s first row and each data row one row; the artifact holds a single sheet, named whatever the CSV read produced rather than a name this step invents
  • 数字只在字节能逐字回来时才是数字:`1727000000000` 变可求和的数,`00424`、`1/2`、`2024-01-05` 保持写下的字符A value is a number only when its bytes come back exactly: `1727000000000` becomes summable, while `00424`, `1/2` and `2024-01-05` keep the characters written
  • 16 位以上的长数字留在文本,因为 Excel 只渲染 15 位有效数字;15 位以内一律不受影响Numbers of 16 or more significant digits stay text because Excel renders 15; nothing at or below 15 digits is touched
  • 最终仍是文本的格子加公式护栏,并把数字格式钉成文本(写出的样式表里那一格就是内置格式号 49);负数已被判为数字,不会被多加前缀Cells that remain text get the formula guard and a pinned text number format — the written styles sheet gives that cell the built-in format id 49; a negative number is already typed as a number and gains no prefix

如实说明的限制What it does not do

  • 两张以上的表转不成 Excel:中间那份 JSON 是以 `<h2>` 文字为键的对象,而 JSON 转 CSV 只接受数组,整批报「JSON 内容必须是包含数据的数组才能转换为 CSV」——把每张表放进各自的文件Two or more tables do not reach Excel: the intermediate JSON is an object keyed by the document’s `<h2>` text, JSON to CSV accepts arrays only, and the batch fails with “JSON must be an array containing data to convert to CSV” — give each table its own file
  • 不会有多张工作表:这条链一次只吃得下一张表,产物永远单 sheetThere is no multi-sheet output: this chain eats one table at a time, so the artifact is always a single sheet
  • 列由表头行定名:比表头多出的单元格被丢掉,比表头短的行不会补键;表头里重复或空白的格子互相覆盖;`colspan` / `rowspan` 不展开,被覆盖的格子不产生值The header row names the columns: cells beyond it are dropped, short rows gain no keys, a repeated or blank header overwrites its twin, and `colspan` / `rowspan` are not expanded — covered cells produce no value
  • 值在中间那步全是字符串,靠最后一步的取数规则回头判数字:`1,234.50`、`¥100`、`45%`、`+33` 都不是十进制形状,留在文本Values are strings in the middle step and only re-typed at the last: `1,234.50`, `¥100`, `45%` and `+33` are not decimal-shaped and stay text
  • 护栏写在字符本身里:以 `=` `+` `-` `@` 开头又仍是文本的格子,产物中该格的值确实以一个 ' 开头(普通文字不受影响)——它换来的是「打开不会被当公式算」The guard lives in the characters themselves: a text cell beginning with `=`, `+`, `-` or `@` holds a leading ' in the written file (ordinary words are untouched), which is what keeps it from being computed as a formula on open
  • 图片与链接只留文字:`![图](a.png)` 的单元格是空值,`[文字](链接)` 只写「文字」;样式、脚本、任务清单的复选框都不进工作表Images and links leave words only: a `![图](a.png)` cell is empty, `[text](url)` writes “text”, and styling, scripts and task-list checkboxes contribute nothing to the sheet

实操提示Working with it

  • 只想看数据、不需要电子表格:Markdown 转 JSON 或转 CSV,多张表的限制在那两页各自写着For the data without a spreadsheet: Markdown to JSON or to CSV, each page stating its own multi-table limit
  • 要给人阅读的成品:Markdown 转 Word、PDF 或 HTML,排版与样式都在那边For something someone reads: Markdown to Word, PDF or HTML, where the layout lives
  • 反方向读回工作表:Excel 转 CSV / JSON / Markdown,多 sheet 会按 sheet 各自成段Coming the other way: Excel to CSV, JSON or Markdown, with each worksheet getting its own section

常见问题Questions people actually ask

Markdown 表格里的数字,进到 Excel 会变成什么?What happens to the numbers in my Markdown table?

看它写下的字符:十进制形状、能逐字节回得来、有效数字不超过 15 位的变成真数字,可以求和;`00424`、`2024-01-05`、`1/2`、16 位的卡号都留在文本,并钉住文本格式(写出的那一格是内置格式号 49)。It depends on the characters written: decimal-shaped values that round-trip byte for byte with at most 15 significant digits become real, summable numbers; `00424`, `2024-01-05`, `1/2` and a 16-digit card number stay text, pinned to the built-in text number format.

为什么两张表就报错,一张就没事?Why does one table work and two fail?

因为中间那步 HTML 转 JSON 对单张表给数组、对多张表给「标题 → 数组」的对象,而对象撞上 JSON 转 CSV 那道「必须是数组」的闸。要两张表,就把它们拆到两个 Markdown 文件里分别转,各自出一份 xlsx。Because the HTML-to-JSON step in the middle yields an array for one table but an object of “heading → array” for several, and that object meets CSV’s “arrays only” gate. For two tables, split them into two Markdown files and convert separately, producing one workbook each.

四步都在本地跑吗?文件会不会经过网络?Do all four steps run locally? Can the file touch the network?

四步都在扩展自己的标签页里完成,用的库(marked、DOMPurify、SheetJS 等)全部打进包里。扩展只申请 storage 权限、没有 host 权限,构建后的产物另有两道离线守卫盯着,所以既没有上传,也没有下载。All four steps run inside the extension’s own tab, with every library (marked, DOMPurify, SheetJS) bundled in. The extension requests the storage permission and no host permissions, and two offline guards audit the built artifact, so nothing is uploaded and nothing is fetched.

不需要账号,也不需要联网:装好扩展后点图标,在新标签页里打开工作台,文件从磁盘直接选。No account and no network: install the extension, click its icon, and the workbench opens in a new tab reading straight off your disk.