CSV Cleaner API

Repair CSV files: detect the encoding (UTF-8, UTF-16, Windows-1258/1252, TCVN3, VNI), the delimiter and header, trim cells, drop empty rows and duplicates, output UTF-8.

POSThttps://apibox.io.vn/v1/csv-clean

CSV files exported from Excel and old Vietnamese software often arrive with garbled text (“Tª n”, “ViÖt Nam”, “Vieät Nam”), semicolons instead of commas, stray spaces and broken rows. The CSV cleaner detects the encoding by trying each candidate and checking which one produces real Vietnamese words: UTF-8 (with or without BOM), UTF-16 from Excel’s “Unicode text”, Windows-1258 and Windows-1252, and text typed with the legacy TCVN3 (ABC) and VNI fonts, which it converts to Unicode.

It detects the delimiter (comma, semicolon, tab, pipe) and parses quoted fields correctly, then cleans the data: trims and collapses spaces, removes invisible characters and no-break spaces, drops empty rows, pads or truncates rows to the header width, makes header names unique and optionally removes duplicate rows. The report says what was detected and changed.

The output is a UTF-8 CSV (with BOM by default, so Excel opens it with Vietnamese characters intact; comma, semicolon or tab delimiter) or JSON records.

Parameters

NameInTypeRequiredDefault
filebodyfilenoCSV file (multipart, raw body or file_base64), or csv text.
csvbodystringnoCSV text.
encodingbody|querystringnoautoForce: utf-8, windows-1258, windows-1252, utf-16le, tcvn3, vni.
delimiterbody|querystringnoInput delimiter (default: detected).
headerbody|querybooleannotrueThe first row is a header.
dedupebody|querybooleannofalseRemove duplicate rows.
formatbody|querystringnocsvcsv or json.
output_delimiterbody|querystringno,,, ; or tab.
bombody|querybooleannotrueStart the CSV with a UTF-8 BOM (for Excel).

Example

curl -X POST "https://apibox.io.vn/v1/csv-clean" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"csv":"Tên; Tuổi ;Tỉnh\n\"Nguyễn Văn An\" ; 30 ;Hà Nội\n\nTrần Thị B;25\n","format":"json"}'

Response

{
  "detected": {
    "encoding": "utf-8",
    "delimiter": ";",
    "header": true
  },
  "rows": 2,
  "columns": 3,
  "report": {
    "input_rows": 5,
    "empty_rows_removed": 1,
    "cells_trimmed": 3,
    "rows_padded": 1,
    "rows_truncated": 0,
    "duplicates_removed": 0,
    "invisible_chars_removed": 0
  },
  "headers": [
    "Tên",
    "Tuổi",
    "Tỉnh"
  ],
  "data": [
    {
      "Tên": "Nguyễn Văn An",
      "Tuổi": "30",
      "Tỉnh": "Hà Nội"
    },
    {
      "Tên": "Trần Thị B",
      "Tuổi": "25",
      "Tỉnh": ""
    }
  ]
}

Use cases

  • Import customer lists from Excel without broken Vietnamese
  • Convert legacy accounting exports (TCVN3 / VNI) to Unicode
  • Normalise CSV uploads before loading them into a database
  • Pre-clean data for spreadsheets and BI tools

FAQ

Why does Excel show broken Vietnamese in my CSV?

Excel opens CSV files as Windows-1258 / 1252 unless they start with a UTF-8 BOM. The cleaned output has a BOM by default (bom=false to remove it).

Can it fix text typed with .VnTime fonts?

Yes, TCVN3 (ABC) and VNI-Windows text is detected and converted to Unicode, even inside an otherwise UTF-8 file.

How big can the file be?

Up to the file size limit of your plan.

Related APIs

Start with 1,000 free requests every month. Get free API key →