Skip to main content

Turn any Excel or CSV file into a backend API with one command

Project description

excel-backend

Turn any Excel or CSV file into a REST API with one command.

pip install excel-backend
excel-backend run students.xlsx
✓ Loaded students.xlsx
  students: 50 rows, 5 columns
  courses: 12 rows, 3 columns
  3 images extracted

✓ API running at http://127.0.0.1:8000
  Docs at http://127.0.0.1:8000/docs

Your data is now a full CRUD API:

GET    /students        → list all students
GET    /students/1      → get student by id
POST   /students        → create a student
PUT    /students/1      → update a student
DELETE /students/1      → delete a student
GET    /images/file.png → serve extracted images

Auto-generated Swagger docs at /docs.

Install

pip install excel-backend

CLI Usage

Start API server

excel-backend run data.xlsx
excel-backend run data.csv
excel-backend run data.tsv

Options:

excel-backend run data.xlsx --port 3000
excel-backend run data.xlsx --host 0.0.0.0
excel-backend run data.xlsx --db data.sqlite  # persist to file

Inspect schema

excel-backend schema data.xlsx
table: students
columns:
  - id INTEGER (primary key)
  - name TEXT
  - age INTEGER
  - photo IMAGE

Python API

from excel_backend import ExcelBackend

eb = ExcelBackend("students.xlsx")

# List tables
print(eb.tables)  # ["students", "courses"]

# Read data
for row in eb["students"]:
    print(row["name"])

# CRUD
eb.create("students", {"name": "Alice", "age": 22})
eb.update("students", 1, {"age": 23})
eb.delete("students", 1)

# Start API server
eb.serve(port=8000)

How It Works

Excel/CSV → Schema Model → SQLite → FastAPI
  1. Loader parses your file (.xlsx, .csv, .tsv)
  2. Schema engine infers column types (INTEGER, FLOAT, TEXT, BOOLEAN, DATE, IMAGE)
  3. Storage adapter creates tables and inserts data (SQLite)
  4. API generator creates CRUD endpoints from the schema

Each sheet in an Excel file becomes a separate table with its own endpoints.

Image Extraction

Images embedded in .xlsx files are automatically:

  • Extracted from the zip archive
  • Mapped to their row/column position
  • Served at /images/{filename}
  • Referenced in API responses

Architecture

excel_backend/
├── schema/model.py      # Schema, Column, type inference
├── loader/
│   ├── base.py          # BaseLoader interface
│   ├── excel.py         # .xlsx parser + image extraction
│   └── csv.py           # .csv/.tsv parser
├── storage/
│   ├── base.py          # BaseStorage interface
│   └── sqlite.py        # SQLite adapter
├── api/generator.py     # Schema → FastAPI routes
└── cli/main.py          # CLI entry point

The Schema model is the core abstraction. Everything flows through it. Storage and API layers are pluggable — they only depend on the Schema, not on each other.

Supported Types

Excel Data Detected Type
1, 42, -3 INTEGER
3.14, 0.5 FLOAT
"hello" TEXT
TRUE/FALSE BOOLEAN
2024-01-15 DATE
embedded image IMAGE

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

excel_backend-0.1.0.tar.gz (19.3 kB view details)

Uploaded Source

Built Distribution

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

excel_backend-0.1.0-py3-none-any.whl (14.7 kB view details)

Uploaded Python 3

File details

Details for the file excel_backend-0.1.0.tar.gz.

File metadata

  • Download URL: excel_backend-0.1.0.tar.gz
  • Upload date:
  • Size: 19.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for excel_backend-0.1.0.tar.gz
Algorithm Hash digest
SHA256 9b56a4fcd2a95849cfd2a0652ac13bd33e7972e7e9fefddb2ebdd55eba087803
MD5 dee41e676d14b29a3b9f133a95aa2b23
BLAKE2b-256 c006916c2b185fc203174ad8cb00e42a42273e07769c70977447794ae14c53a1

See more details on using hashes here.

File details

Details for the file excel_backend-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: excel_backend-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 14.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for excel_backend-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 18119d806b0d55c8b67328f5c477140ecd9fd87e41ea6dd8eec933939512a244
MD5 daf3c5a22ac42e97394a050b31a53bab
BLAKE2b-256 27e1ed8d9a6e4d6fb927582830c5bdc06a6b0427164ebff931bdd14c5bc56c81

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