CSV Editor online

Code

Export

My documents

Click a document to open it. They are stored only in this browser - nothing is uploaded. Clearing the browser's site data removes them, so download the ones you want to keep.

AI Assistant

Any AI can work with you - ChatGPT, Claude, Gemini, Copilot.

  1. Click Copy prompt.
  2. Paste it into your AI and say what it should do with the table.
The AI should

The table travels in the link after the “#”, which no server sees. What you paste into your AI is handled by its provider.

Save to your server

The editor can send each saved version to your own server (a webhook), so your work is kept where you want it. Nothing is sent until you enter an address here.

What your server receives

A POST request with JSON (your server must allow CORS from https://csv.giit.ch):

{ "editor": "csv", "event": "save", "id": "…", "name": "Products",
  "content": "SKU,Product,Price\nA-100,Notebook,4.50\n",
  "updated": "2026-01-15T09:30:00.000Z" }
Embed the editor in your website
<iframe src="https://csv.giit.ch/?embed=1" style="width:100%;height:80vh;border:0"></iframe>
<script>
const frame = document.querySelector('iframe');
addEventListener('message', e => {
  if (e.origin !== 'https://csv.giit.ch' || e.source !== frame.contentWindow) return;
  if (e.data.type === 'csveditor:ready')
    frame.contentWindow.postMessage({ type: 'csveditor:load', name: 'Products',
      content: 'SKU,Product,Price\nA-100,Notebook,4.50\n' }, 'https://csv.giit.ch');
  if (e.data.type === 'csveditor:save') saveOnYourServer(e.data.content);
});
</script>

Also possible: ?src=<URL of a .csv file> opens a file, &webhook=<URL> saves this document there. The editor can also open in a window of its own (?embed=window), and your page can hand it its own AI prompt and a session key so the AI sends its result to your server (csveditor:ai, csveditor:key-request) - see "Use the editor on your own website" below the editor. Details are in llms.txt.

Help

How it works

  1. Open a CSV file, drop it into the window, or start with New. The raw text is on the left, the table in the middle.
  2. Edit cells in the table like in a spreadsheet: type, or press Enter or F2, or double-click a cell. Enter or Tab keeps the value, Escape cancels. The change goes into the CSV text right at that field - quotes only where needed, the line endings stay - and is one step for Undo.
  3. Copy and paste ranges between the table and Excel, LibreOffice or Google Sheets with Ctrl+C and Ctrl+V. Type into the row marked + to add a row.
  4. A click in the table puts the code's cursor on that field; the cursor in the code selects its cell.
  5. Sort with the arrows in the column heads and filter above the table: that only changes the view. Sort the data puts the rows of the file into that order.
  6. Format on the right sets how the text is read (separator, quote, header row) and converts it; Column shows what a column holds; Insert adds, deletes and moves rows and columns and cleans up.
  7. Problems (rows with another number of fields, unclosed quotes, empty or repeated header names) are listed above the code - click one to go there.
  8. Export makes an Excel workbook, JSON, Markdown, HTML, TSV or CSV with another separator. Download .csv saves the text as it is.

Keyboard shortcuts in the table

← → ↑ ↓, Shift + arrows
Move, select a range
Enter / F2 / typing
Edit the cell (typing replaces its value)
Alt + Enter
A line break inside the cell
Tab / Shift + Tab
Next / previous cell
Delete
Empty the selected cells
Ctrl + C / X / V
Copy / cut / paste (tab-separated, as spreadsheets use it)
Ctrl + A
Select the whole table
Ctrl + F
Filter the rows
Ctrl + Z / Y
Undo / redo
Ctrl + S / E
Save (download .csv, or to your server) / export
Ctrl + O
My documents
Ctrl + Enter in the code
Go to the cursor's cell in the table

在线编辑 CSV 文件,表格与文本并用

CSV 编辑器将原始 CSV 和表格并排显示。在表格中编辑单元格,编辑器只会修改文本中的该字段,其他引号、分隔符和行尾都保持原样。在表格中点击会在文本中显示该字段,文本中的光标也会显示其单元格。这样就能快速修正网店、银行和数据库的导出文件,清理地址列表,或为导入准备数据。

一切都在你的浏览器中运行。文件不会上传,无需注册,也没有广告。

编辑器的功能

像电子表格一样

在单元格中输入,用方向键和 Tab 移动,与 Excel、LibreOffice 或 Google Sheets 互相复制粘贴区域,添加、删除和移动行与列。

任何 CSV

逗号、分号、制表符或竖线作为分隔符,自动检测;有无表头行均可;支持带或不带 BOM 的 UTF-8 和 Windows-1252;保留 Windows 和 Unix 行尾。

找出损坏之处

字段数不同的行、未闭合的引号、空的和重复的列名,都会连同行号列出,一点即达。

排序、筛选、细看

排序和筛选视图而不改动文件,或对数据本身排序。列面板显示值的类型、空值和不同值的数量、总和与平均值。

大文件

表格只绘制你看到的行:10 万行的文件依然能流畅地滚动、筛选和编辑。

导出

Excel 工作簿(XLSX)、JSON、Markdown 和 HTML 表格、TSV,或使用其他分隔符和编码的 CSV,并能防范电子表格公式。

使用方法

  1. 打开:将 CSV 文件拖放到窗口中,用“打开文件…”打开,或在“新建”中选择模板开始。
  2. 编辑:在表格或左侧文本中修改单元格;两者相互同步。用“插入”添加行和列,用“格式”设置分隔符。
  3. 保存:按原样下载 CSV,或导出为 XLSX、JSON、Markdown 或 HTML。

在你自己的网站上使用编辑器

任何 https 页面(以及 localhost)都可以用 <iframe> 和 ?embed=1 嵌入编辑器,无需注册,无需密钥。嵌入后,编辑器会隐藏这段文字并显示“保存”按钮。有两种方式传入和取出表格。

1. 从链接打开文件,保存到你的服务器

src= 打开一个文件(你的服务器必须允许 CORS),webhook= 让“保存”(Ctrl+S)把文档发送到该地址。加上 &token=… 可发送 Authorization: Bearer … 请求头,加上 &auto 则每次更改后都会保存。

<iframe src="https://csv.giit.ch/?embed=1&src=https://your-site.com/data/products.csv&webhook=https://your-site.com/save.php"
        allow="clipboard-write" style="width:100%;height:800px;border:0"></iframe>

Webhook 会收到一个带 JSON 的 POST 请求 { editor: "csv", event: "save", id, name, content, updated }。一个保存它的简短 PHP 脚本:

<?php
header('Access-Control-Allow-Origin: https://csv.giit.ch');
header('Access-Control-Allow-Headers: Content-Type, Authorization');
header('Access-Control-Allow-Methods: POST, OPTIONS');
if ($_SERVER['REQUEST_METHOD'] === 'OPTIONS') exit;
if (($_SERVER['HTTP_AUTHORIZATION'] ?? '') !== 'Bearer SECRET') { http_response_code(403); exit; }
$d = json_decode(file_get_contents('php://input'), true);
$name = preg_replace('/[^\w\- ]/u', '_', $d['name']);
file_put_contents(__DIR__ . "/data/$name.csv", $d['content']);
echo '{"ok":true}';

2. 由你的页面保存文档(postMessage)

编辑器发送 csveditor:ready,你的页面以 csveditor:load 回应,编辑器报告 csveditor:loaded,有实际编辑时发送 csveditor:change,用户保存时发送 csveditor:save。你的页面可以发送 csveditor:get(获取当前状态)或 csveditor:save(相当于点击“保存”)。这样保存就通过你自己的登录和会话进行。

<iframe id="ed" src="https://csv.giit.ch/?embed=1" allow="clipboard-write" style="width:100%;height:800px;border:0"></iframe>
<script>
const ed = document.getElementById('ed');
const ORIGIN = 'https://csv.giit.ch';

addEventListener('message', async e => {
  if (e.source !== ed.contentWindow || e.origin !== ORIGIN) return;
  const m = e.data;
  if (m.type === 'csveditor:ready') {               // 编辑器已就绪:把文档交给它
    ed.contentWindow.postMessage({
      type: 'csveditor:load',
      name: 'Products',
      content: await (await fetch('/data/products.csv')).text()
    }, ORIGIN);
  }
  if (m.type === 'csveditor:change') document.title = '● not saved';   // 一次实际编辑
  if (m.type === 'csveditor:save') {                // 用户点击了“保存”
    await fetch('/api/save', { method: 'POST', headers: { 'Content-Type': 'application/json' },
      body: JSON.stringify({ name: m.name, content: m.content }) });
    document.title = 'Saved';
  }
});

// 你自己页面上的保存按钮:回应以 csveditor:save 返回
function saveNow() { ed.contentWindow.postMessage({ type: 'csveditor:get' }, ORIGIN); }
</script>

页面内的 AI 助手:在框架中同样可用。在 iframe 上设置 allow="clipboard-write" 后,“复制提示词”会直接使用剪贴板(否则编辑器会退回旧的复制命令,或显示提示词供手动复制)。AI 发送的链接无法到达另一个网站中的编辑器,因此编辑器会提示 AI 和用户把 AI 的完整回答粘贴到编辑器中,或在单独的窗口中打开编辑器。

3. 在单独的窗口中

window.open("https://csv.giit.ch/?embed=window", "csveditor-17") 会在单独的窗口中打开完整的编辑器,并通过 window.opener 使用相同的消息。AI 的链接可以到达那里。csveditor:load 还可以带上 context: { host, title, rules }(AI 提示词随后会说明文档属于哪里,并遵循你的规则),以及 hook: { url, token },即仅用于此文档、从不保存的 Webhook。关闭有未保存更改的窗口时会发送 csveditor:closing。

4. 通过你自己的服务器使用 AI

向编辑器提供你自己的提示词、你网站上的一个地址和本次编辑器会话的密钥。AI 对话框随后会显示“已连接到”你的网站、你告诉 AI 的内容,以及修改当前文档或新建一个文档的选项;复制提示词会把这些都组合起来。AI 带着密钥把结果发送到你的服务器,你的页面再在编辑器中打开它;新文档会单独打开,并保留在用户的浏览器中。每个编辑器会话一个密钥:编辑器打开期间有效,只有在没有密钥时,编辑器才会用 csveditor:key-request 请求。编辑器自己从不发送密钥,也从不保存它;地址必须是你自己主机或其子域名上的 https 地址。

const key = async () => (await fetch('/api/ai-key.php?doc=17')).json();   // 每个编辑器会话一个密钥
const k = await key();
ed.contentWindow.postMessage({ type: 'csveditor:load', name: 'Products', content, ai: {
  label: 'My Site', prompt: 'Keep the column names. Prices in CHF.',
  endpoint: 'https://your-site.com/api/ai-result.php', key: k.key } }, ORIGIN);
// 记住 csveditor:loaded 中的 id,忽略 id 不同的 change/save/closing
// 仅在编辑器没有密钥时:
if (m.type === 'csveditor:key-request') { const k = await key(); ed.contentWindow.postMessage({ type: 'csveditor:ai', key: k.key }, ORIGIN); }
// 编辑器打开期间,每分钟通知你的服务器;关闭编辑器或页面会使密钥作废
setInterval(() => fetch('/api/ai-key.php?alive=' + k.key.slice(0, 8)), 60000);
// 你的服务器有了结果(轮询、SSE …):target 为 "current" 或 "new"
ed.contentWindow.postMessage({ type: 'csveditor:load', name: 'Products', content: draft, from: 'ai', target }, ORIGIN);

密钥至少使用 128 位随机数,只保存其哈希值,将每个密钥绑定到已登录用户、文档和本次编辑器会话,每个会话一个,仅在你的页面报告会话仍打开时有效,并在编辑器或页面关闭时作废。

完整协议见 llms.txt,把它交给 AI,AI 就能为你的系统建立连接。其他 giit 编辑器的用法相同,只是前缀不同,例如 LaTeX 编辑器使用 latexeditor:,见 latex.giit.ch。

常见问题

我的 CSV 文件会被上传吗?

不会。编辑器完全在你的浏览器中运行。你的文件绝不会发送到服务器,除非你自己设置了指向自己服务器的 Webhook。

编辑一个单元格时,编辑器会改动我的文件吗?

只改动该单元格。编辑器会把更改准确写入 CSV 文本中该字段所在的位置,其余部分保持原样:其他引号、分隔符和行尾都不变。只有在需要时,字段才会加上引号。

我的 CSV 用分号分隔,可以吗?

可以。编辑器能检测逗号、分号、制表符和竖线分隔符;你也可以在格式中选择。转换可将文件改为其他分隔符。

如何在 Excel 中打开 CSV 而不出现乱码?

导出为 XLSX,或下载带字节顺序标记(BOM)的 CSV:在格式中勾选它,或在导出中选择“UTF-8 带 BOM”。这样 Excel 就能正确读取 UTF-8。

能处理大文件吗?

能。表格只绘制你看到的行,因此 10 万行的文件依然能流畅地滚动、筛选和编辑。

我的文档保存在哪里?

只保存在你的浏览器中。点击左上角的文件夹按钮(我的文档)即可打开、重命名、复制、下载或删除它们。清除浏览器的网站数据会删除它们,因此请下载需要保留的文档,或让编辑器把它们发送到你自己的服务器(“保存到服务器”)。非常大的文件可能放不进浏览器的存储空间;遇到这种情况时编辑器会告诉你。

AI 能在 CSV 编辑器中写作吗?

能,任何 AI 都可以:ChatGPT、Claude、Gemini、Copilot 或你编程工具中的 AI。点击“AI 助手”,再点击“复制提示词”,粘贴到你的 AI 中并说明要做什么。AI 会回复一个链接;点击它,表格就会出现在你的编辑器中。“撤销”可撤回每一处更改。

CSV 编辑器收费吗?

不收费。编辑器免费,没有广告,无需注册。