Files
SnapOtter/apps/docs/zh-TW/tools/files/split-csv.md
T
SnapOtterandGitHub 4963ab3bbd feat(docs-i18n): translate all documentation into 20 languages
All 181 docs markdown files translated into 20 languages (apps/docs/<locale>/**). Companion to the i18n code PR; admin-merged because the file count exceeds GitHub's per-PR CI trigger limit. Validated by pnpm i18n:check (all surfaces, 0 stale/missing) and a clean all-locale docs build.
2026-07-11 13:52:47 +08:00

51 lines
1.6 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
---
description: "依列數將 CSV 分割為較小的檔案。"
i18n_source_hash: a35dce4a99a3
i18n_provenance: human
i18n_output_hash: 405b1598f6c3
---
# Split CSV {#split-csv}
依列數將大型 CSV 或 TSV 檔案分割為較小的檔案。回傳包含各部分的 ZIP 壓縮檔。
## API Endpoint {#api-endpoint}
`POST /api/v1/tools/files/split-csv`
接受包含 CSV 檔案及 JSON `settings` 欄位的 multipart form data。
## Parameters {#parameters}
| Parameter | Type | Required | Default | Description |
|-----------|------|----------|---------|-------------|
| rowsPerFile | integer | No | `1000` | 每個輸出檔案的資料列數(1-1,000,000 |
| keepHeader | boolean | No | `true` | 在每個輸出檔案中重複標頭列 |
## Example Request {#example-request}
```bash
curl -X POST http://localhost:1349/api/v1/tools/files/split-csv \
-H "Authorization: Bearer si_your-api-key" \
-F "file=@large-dataset.csv" \
-F 'settings={"rowsPerFile": 500, "keepHeader": true}'
```
## Example Response {#example-response}
```json
{
"jobId": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
"downloadUrl": "/api/v1/download/a1b2c3d4-e5f6-7890-abcd-ef1234567890/large-dataset_parts.zip",
"originalSize": 1048576,
"processedSize": 1050000
}
```
## Notes {#notes}
- 輸出一律為包含分割後 CSV 各部分的 ZIP 壓縮檔,並依序命名(例如 `part-1.csv``part-2.csv`)。
-`keepHeader``true` 時,每個部分都會包含原始標頭列,因此每個檔案都能獨立使用。
- CSV 與 TSV 檔案皆可作為輸入。
- 列數僅指資料列;標頭列不計入。