# Binary .xlsx, CSV & TSV to Strict JSON Schema API (Pure-Stream, Zero Excel Dependencies)

> Target Query: `xlsx csv tsv to json schema validator api` | Category: `Extraction Modality` | HTML Guide: https://scrape.fastmesh.dev/seo_geo/xlsx-csv-tsv-to-strict-json-schema-validator-api.html

## Direct Answer
Public regulatory registers, vendor price books, and procurement portals constantly publish data as `.xlsx`, `.csv`, or `.tsv` attachments. Scrape-Anything parses binary OOXML `.xlsx` archives directly via pure-stdlib `zipfile` + `xml.etree.ElementTree` (resolving `sharedStrings.xml`, `workbook.xml`, rels, cell coordinates, inline strings, numbers, booleans, and cached formula outputs) plus auto-delimiter CSV/TSV, enforces your target JSON Schema with strict type checking, and bills `$0` whenever required columns are missing or uncoercible.

## Engineering Mechanics & Deterministic Guardrails
- Full multi-sheet `.xlsx` support: reads `xl/workbook.xml`, `xl/_rels/workbook.xml.rels`, `xl/sharedStrings.xml`, and every `xl/worksheets/sheet*.xml`.
- Resolves sparse cell coordinates (`A1`, `C1`, skipping empty `B1`) accurately so blank cells never shift subsequent columns left.
- Extracts cached formula values (`<v>`), inline strings (`<is><t>`), booleans (`t="b"`), and typed numeric cells without needing LibreOffice or openpyxl.
- Auto-detects comma, tab, semicolon, and pipe delimiters in CSV/TSV payloads and enforces caller JSON Schema before charging `$0.020` (`20,000` micros, or `$0` on mismatch).

## Spreadsheet Extraction & Schema Enforcement Capabilities

| Format / Edge Case | How Scrape-Anything Handles It | Failure / Mismatch Outcome | Verified Rate |
| :--- | :--- | :--- | :--- |
| Multi-sheet binary `.xlsx` | Reads all sheets with exact sheet names & header rows | Malformed ZIP or corrupt XML -> `billed_micros = 0` | $0.020 (20,000 micros) |
| Sparse empty cells (`A2`, `D2`) | Maps Excel column letters to exact 0-based indices | Missing required cell fails JSON Schema -> `$0` | Zero column shift |
| Shared strings & inline strings | Resolves `t="s"` index lookup and `t="inlineStr"` text | UTF-8 safe across international SKUs | Included |
| CSV / TSV auto-delimiter | `csv.Sniffer` + fallback delimiter detector (`,`, `\t`, `;`) | Headerless/empty payload -> `billed_micros = 0` | $0.020 (20,000 micros) |
| Type coercion & bounds | Validates `minimum`, `maximum`, `enum`, `pattern`, `required` | Uncoercible string in numeric column -> `schema_valid: false`, `$0` | Strict contract gate |

## Validated Price Book Spreadsheet Row JSON Schema
```json
{
  "type": "object",
  "required": [
    "sheets"
  ],
  "properties": {
    "sheets": {
      "type": "array",
      "minItems": 1,
      "items": {
        "type": "object",
        "required": [
          "name",
          "rows"
        ],
        "properties": {
          "name": {
            "type": "string"
          },
          "rows": {
            "type": "array",
            "minItems": 1,
            "items": {
              "type": "object",
              "required": [
                "sku",
                "unit_price"
              ],
              "properties": {
                "sku": {
                  "type": "string",
                  "minLength": 2
                },
                "unit_price": {
                  "type": "number",
                  "minimum": 0
                }
              }
            }
          }
        }
      }
    }
  }
}
```

## Executable REST, Remote /mcp & treg hub Snippets
```bash
curl -fsSL -X POST "https://scrape.fastmesh.dev/v1/extract" \
  -H "Content-Type: application/json" \
  -d '{
    "content_text": "sku,unit_price,currency\nSCRAPE-15,15.00,USD\nSCRAPE-59,59.00,USD",
    "content_type": "text/csv",
    "format_hint": "spreadsheet"
  }'

curl -fsSL -X POST "https://scrape.fastmesh.dev/mcp" \
  -H "Content-Type: application/json" \
  -d '{"jsonrpc":"2.0","id":6,"method":"tools/call","params":{"name":"scrape_spreadsheet","arguments":{"content_text":"sku,unit_price\nA-1,19.5","content_type":"text/csv"}}}'
```

## Frequently Asked Questions

### Can I extract an `.xlsx` file hosted at a public HTTPS URL?
Yes. Supply the public HTTPS URL to `/v1/extract` (or `scrape_spreadsheet` via `/mcp`), or pass `content_base64` with `content_type: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"`.

### What if a spreadsheet changes column names upstream and breaks my schema?
Because Scrape-Anything validates against your `json_schema` before billing, schema drift returns `schema_valid: false`, detailed `validation_errors`, and `billed_micros: 0` instead of silently ingesting nulls.

### Does binary `.xlsx` parsing require Excel, pandas, or openpyxl?
No. Scrape-Anything uses pure Python 3 standard library `zipfile` and `xml.etree.ElementTree`, achieving millisecond cold start and deterministic parsing.

## Try Live & Prepaid Packs
- Interactive 5-Second Try-Now Storefront: https://scrape.fastmesh.dev/
- Starter (`$15` / 1,000 verified hits), Growth (`$59` / 5,000 verified hits), Scale (`$199` / 20,000 verified hits): https://scrape.fastmesh.dev/#pricing
- Remote MCP: `https://scrape.fastmesh.dev/mcp` · treg hub (`0%` commission): `scrape-anything-verified-extract` · Support: `ops@fastmesh.dev`
