Skip to main content

Extract structured data from Excel files with minimal token usage

Project description

carloforte

Extract structured data from Excel files with minimal token usage.

carloforte uses an island-detection algorithm to convert Excel sheets into a compact intermediate representation (CSV, Markdown, or JSON), making it efficient to pass spreadsheet data to LLMs.

Installation

uv add carloforte

Usage

import carloforte

# Extract all sheets as CSV (default)
text = carloforte.extract("data.xlsx")

# Extract specific sheets as Markdown
text = carloforte.extract("data.xlsx", sheets=["Revenue", "Costs"], fmt="markdown")

# Extract as JSON
text = carloforte.extract("data.xlsx", fmt="json")

Formats

Format Best for
csv Compact, low token count
markdown Readable, good for LLM prompts
json Structured output, programmatic use

CLI

carloforte data.xlsx --fmt markdown
carloforte data.xlsx --sheets Revenue Costs --fmt json

How it works

Excel sheets often contain multiple disconnected tables, empty rows, and metadata scattered around. carloforte detects each contiguous block of data ("island") independently and serialises only what matters — reducing token usage by 60–75% compared to passing raw Excel content to an LLM.

Architecture

flowchart LR
    A["📄 .xlsx file"] --> B["_reader\nload sheets"]
    B --> C["dict[sheet → grid]"]
    C --> D["_islands\nBFS detection"]
    D --> E["dict[sheet → islands]"]
    E --> F{"fmt?"}
    F -->|csv| G["CSV"]
    F -->|markdown| H["Markdown"]
    F -->|json| I["JSON"]

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

carloforte-0.1.1.tar.gz (4.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

carloforte-0.1.1-py3-none-any.whl (6.1 kB view details)

Uploaded Python 3

File details

Details for the file carloforte-0.1.1.tar.gz.

File metadata

  • Download URL: carloforte-0.1.1.tar.gz
  • Upload date:
  • Size: 4.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.7 {"installer":{"name":"uv","version":"0.11.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for carloforte-0.1.1.tar.gz
Algorithm Hash digest
SHA256 485f28b982f9e6aba86213efdf5dbf97fdc645d06ea7984c199aa18226d605f3
MD5 863c700730a187322966da074bf191c6
BLAKE2b-256 93fb9a29d79725fcc5de5b5631b4207716a70f4fadfedb162a2f20b217a5bfa1

See more details on using hashes here.

File details

Details for the file carloforte-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: carloforte-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 6.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.7 {"installer":{"name":"uv","version":"0.11.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for carloforte-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 e7b3f4d012495042ca817287516a6fe7ba891520144ba8ed5040d86290141eed
MD5 58e12c4b24c8a903d52c1d1f97ae676d
BLAKE2b-256 b2b767409aa5d9e7f149f639f954d25b8a7168e70bf05d53c3de9b328f6d387b

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page