离线 · 无上传 · 浏览器本地完成Offline · no uploads · runs in the browser
CSV 转 HTML 表格——离线、可批量、不上传CSV to HTML table offline, in batches, no upload
把 CSV 贴进网页,最省事的办法是转成一张 `<table>`;用「按逗号切一行」的脚本做这件事,会在第一个带引号的逗号上翻车。这条链路交给 SheetJS 的 CSV 解析器:引号、字段内换行、列序都按 CSV 的规矩处理,再把每张表写成 HTML 表格并包成一份能直接打开的文档。值按文件里的字符原样呈现——不做类型推断,所以日期不会被改写成 `1/5/24`。Pasting a CSV into a web page means turning it into a `<table>`, and the quick script that splits each line on commas fails at the first quoted comma. This route hands that job to SheetJS’s CSV parser — quotes, newlines inside a field and column order all follow CSV’s rules — writes each sheet as an HTML table and wraps it in a document you can open. Values print as the file’s own characters, with no type inference, so a date is not rewritten into `1/5/24`.
这条链路怎么走How the route runs
CSVCSV HTMLHTML
共 1 步,由扩展的路径搜索自动选出,中间产物不落盘。1 step, chosen by the extension's own path search; intermediate results never touch the disk.
会保留什么What carries over
- 带引号的逗号、字段内的换行、成对的引号转义,都按 CSV 的语法解析成一个单元格,不是按逗号切字符串Quoted commas, newlines inside a field and doubled quote escapes all parse into one cell under CSV’s grammar, rather than a string split on commas
- 每一行都写成表格里的一行,第一行也在内——不像 CSV 转 JSON 会拿首行当键名;列序与文件里一致Every row becomes a table row, the first included — unlike CSV to JSON, which spends row one on key names — and columns keep file order
- 值原样呈现:按 raw 模式读取,单元格里那串字符就是最终看到的文本Values print as written: the file is read raw, so the characters in the field are the text you get
- 编码不是前提:按 UTF-8 → GB18030 → GBK 依次尝试解码,老编辑器导出的 GBK 文件也读得进来The encoding is not a precondition: input is decoded UTF-8 → GB18030 → GBK, so a GBK file from an older editor still reads
如实说明的限制What it does not do
- 只产表格结构:CSV 本身不带样式,所以字体、列宽、单元格颜色都不会出现(页面用的是文档的默认样式)Structure only: a CSV carries no styling, so no fonts, column widths or cell colours appear — the page uses the document’s default stylesheet
- 数值不会被「翻译」:`00123` 还是 `00123`,`1-5` 还是 `1-5`——好处是不被改错,代价是它不替你做类型化Nothing is “translated”: `00123` stays `00123` and `1-5` stays `1-5` — the benefit is not being misread, the cost is no typing
- 列少而文字长时按词断行挤进页面宽度;列多到每格的内边距撑过页面时,表格会比页面宽,需要横向滚动——两种都不丢数据,但都不是替你重排Few wide columns wrap inside the page width; once the per-cell padding floor exceeds it the table grows past the page and needs a sideways scroll — neither case loses data, and neither one re-flows your content for you
- 一张表最多读 50 万格、整个工作簿最多 100 万格,超过直接报错,不会给你一份截断的页面At most 500,000 cells per sheet and 1,000,000 per workbook are read; past that it fails rather than shipping a truncated page
- 四种编码都读不出文本时直接报错,不产出一份乱码页面If none of the four encodings yields text, it fails rather than producing a page of mojibake
实操提示Working with it
- 一批最多 200 个文件,单个文件上限 100 MB;多个 .csv 一起转逐个产出各自的 .html,想一次拿走就打成一个 ZIPUp to 200 files per batch and 100 MB per file; several .csv files yield one .html each, and the set can be taken as a single ZIP
- 产出的 HTML 还能接着转:转 Word(表格进文档)、转 PDF(整页渲染、没有文字层)、转 Markdown(管道表)The HTML carries on: to Word (tables into a document), to PDF (rendered pages, no text layer), to Markdown (a pipe table)
- 要的是能再计算的数据表,走 CSV 转 Excel;要对象数组,走 CSV 转 JSON(那条会把首行当键名)For data you can keep computing on, take CSV to Excel; for objects, take CSV to JSON — that route spends row one on key names
常见问题Questions people actually ask
字段里有逗号和换行,会切错吗?My fields contain commas and newlines — will they split wrong?
不会。分隔与引号交给 SheetJS 的 CSV 解析器,不是把一行按逗号 split,所以 `"a,b"` 是一个单元格、字段内的换行也留在同一个单元格里。要导出时保持这个形状,走 HTML 转 CSV 或 Excel 转 CSV 那两条。No. Splitting is SheetJS’s CSV parser rather than a string split on commas, so `"a,b"` is one cell and a newline inside a field stays inside it. To write that shape back out, take HTML to CSV or Excel to CSV.
为什么日期前面没有变成斜杠写法?Why has a date not been rewritten into slashes?
因为这条链路按 raw 模式读,值就是文件里那串字符。类型推断会把 `2024-01-05` 变成日期序列号再打印成 `1/5/24`——那是「看起来更聪明但可能改错」的典型。要数字与日期被真正类型化的产物,走 CSV 转 JSON。Because the file is read raw, so a value is the characters in the file. Type inference would turn `2024-01-05` into a date serial and print it as `1/5/24` — the classic «cleverer but possibly wrong». For genuinely typed output, take CSV to JSON.
客户名单要转成网页,数据会外发吗?If I turn a customer list into a page, does the data leave my machine?
不会。解析与写页面都在扩展的标签页里完成,只申请 storage 权限、没有 host 权限,产出的文档也不引用任何远端资源;除了你拖进来的文件,没有别的数据来源。No. Parsing and page writing both happen in the extension’s tab; it asks for the storage permission only, has no host permissions, and the produced document references no remote resource. Apart from the files you drop in, there is no other source of data.
不需要账号,也不需要联网:装好扩展后点图标,在新标签页里打开工作台,文件从磁盘直接选。No account and no network: install the extension, click its icon, and the workbench opens in a new tab reading straight off your disk.
从 Chrome 应用商店安装Install from the Chrome Web Store 安装步骤Install steps GitHub 源码Source on GitHub