MCPcopy Index your code
hub / github.com/dimastbk/python-calamine

github.com/dimastbk/python-calamine @v0.7.0

Chat with this repo
repository ↗ · DeepWiki ↗ · release v0.7.0 ↗ · + Follow
104 symbols 294 edges 15 files 0 documented · 0% 3 cross-repo links
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

python-calamine

PyPI - Version Conda Version Python Version from PEP 621 TOML

Python binding for beautiful Rust's library for reading excel and odf file - calamine.

Is used

Installation

Pypi:

pip install python-calamine

Conda:

conda install -c conda-forge python-calamine

Example

from python_calamine import CalamineWorkbook

workbook = CalamineWorkbook.from_path("file.xlsx")
workbook.sheet_names
# ["Sheet1", "Sheet2"]

workbook.get_sheet_by_name("Sheet1").to_python()
# [
# ["1",  "2",  "3",  "4",  "5",  "6",  "7"],
# ["1",  "2",  "3",  "4",  "5",  "6",  "7"],
# ["1",  "2",  "3",  "4",  "5",  "6",  "7"],
# ]

By default, calamine skips empty rows/cols before data. For suppress this behaviour, set skip_empty_area to False.

from python_calamine import CalamineWorkbook

workbook = CalamineWorkbook.from_path("file.xlsx").get_sheet_by_name("Sheet1").to_python(skip_empty_area=False)
# [
# [",  ",  ",  ",  ",  ",  "],
# ["1",  "2",  "3",  "4",  "5",  "6",  "7"],
# ["1",  "2",  "3",  "4",  "5",  "6",  "7"],
# ["1",  "2",  "3",  "4",  "5",  "6",  "7"],
# ]

Pandas 2.2 and above have built-in support of python-calamine.

Also, you can find additional examples in tests.

Development

You'll need rust installed.

# clone this repo or your fork
git clone git@github.com:dimastbk/python-calamine.git
cd python-calamine
# create a new virtual env
python3 -m venv env
source env/bin/activate
# install dev dependencies and install python-calamine
pip install --group dev -e .  # required pip 25.1 and above
# lint code
pre-commit run --all-files
# test code
pytest

Core symbols most depended-on inside this repo

to_python
called by 24
src/types/sheet.rs
from_object
called by 20
src/types/workbook.rs
get_sheet_by_index
called by 19
src/types/workbook.rs
get_sheet_by_name
called by 9
src/types/workbook.rs
from_path
called by 7
src/types/workbook.rs
end
called by 4
src/types/sheet.rs
get_table_by_name
called by 4
src/types/workbook.rs
close
called by 4
src/types/workbook.rs

Shape

Method 51
Function 42
Enum 6
Class 5

Languages

Rust63%
Python37%

Modules by API surface

src/types/workbook.rs26 symbols
src/types/sheet.rs23 symbols
tests/test_base.py18 symbols
tests/test_pandas.py8 symbols
src/types/table.rs8 symbols
tests/test_tables.py6 symbols
tests/test_sheet_type.py4 symbols
src/types/cell.rs4 symbols
tests/conftest.py2 symbols
src/types/errors.rs2 symbols
src/lib.rs2 symbols
build.rs1 symbols

For agents

$ claude mcp add python-calamine \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact