Files
SnapOtter/apps/docs/tools/data/xml-to-csv.md
T
SnapOtter d24e244af4 docs: organize tool pages by modality under /tools/<modality>/
Move all 157 tool pages into image/video/audio/pdf/data subfolders so URLs read /tools/<modality>/<id> (e.g. /tools/image/crop). Nest the image sub-categories under an Image group in the sidebar so the nav reads by modality. Add public/_redirects (301, clean + .html forms) mapping every old flat /tools/<id> URL to its new path so inbound links keep working. Rewrite all internal /tools links. Verified with a clean docs build (no dead links).
2026-06-18 14:12:28 +08:00

44 lines
1.2 KiB
Markdown

---
description: Extract repeating elements from XML into a CSV table.
---
# XML to CSV
Extract repeating elements from an XML file into a flat CSV table. The tool automatically finds the first array of objects in the XML tree and maps each element to a row.
## API Endpoint
`POST /api/v1/tools/data/xml-to-csv`
Accepts multipart form data with an XML file. No settings field is required.
## Parameters
This tool has no configurable parameters. The repeating element is auto-detected from the XML structure.
## Example Request
```bash
curl -X POST http://localhost:1349/api/v1/tools/data/xml-to-csv \
-H "Authorization: Bearer si_your-api-key" \
-F "file=@catalog.xml"
```
## Example Response
```json
{
"jobId": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
"downloadUrl": "/api/v1/download/a1b2c3d4-e5f6-7890-abcd-ef1234567890/catalog.csv",
"originalSize": 4500,
"processedSize": 1800
}
```
## Notes
- Only `.xml` files are accepted as input.
- The tool scans the XML tree for the first repeating set of sibling elements and uses those as rows.
- Each unique child element or attribute name becomes a CSV column header.
- This is a one-way conversion. For bidirectional JSON/XML conversion, use the [JSON to XML](/tools/data/json-xml) tool.