A lightweight Excel workbook calculator that uses the formulas engine to compute cell values.
Project description
calc-workbook
calc-workbook is a lightweight Python package that loads Excel files, computes all formulas using the formulas package, and provides a simple, high-level API to access the computed cell values from each sheet.
Unlike other Excel packages, it focuses purely on formula evaluation and data retrieval in a Pythonic way.
Overview
openpyxl is the most common Python package for reading and writing Excel files; however, it does not calculate cell formulas.
The formulas package adds support for evaluating a large set of Excel formulas, but it does not provide a straightforward interface to retrieve the computed values per sheet.
calc-workbook bridges that gap by exposing a simple interface with two core classes:
CalcWorkbook– loads and computes the workbook, providing access to individual sheets.CalcSheet– provides access to computed cell values and sheet metadata.
Installation
pip install calc-workbook
Example Code
from calc_workbook import CalcWorkbook
# Load workbook and compute formulas
wb = CalcWorkbook.load("example.xlsx")
# List available sheets (in lowercase)
print(wb.get_sheet_names())
# Access a specific sheet in lowercase
sheet = wb.get_sheet("sheet1")
# Retrieve computed values
print("A1:", sheet.cell("A1"))
print("A1:", sheet.cell([1, 1]))
print("B1:", sheet.cell("B1"))
print("C1:", sheet.cell("C1"))
Limitations
- Sheet names are stored and accessed in lowercase internally.
When calling
get_sheet(), always use the lowercase name (e.g.,"sheet1").
API Reference
class CalcWorkbook
Represents a computed Excel workbook.
Methods
| Method | Description |
|---|---|
load(filename: str) -> CalcWorkbook |
Loads an Excel file, computes all formulas using the formulas engine, and returns a ready-to-use workbook. |
get_sheet_names() -> list[str] |
Returns the list of all sheet names in the workbook. |
get_sheet(name: str) -> CalcSheet |
Returns a CalcSheet object for the given sheet name. |
class CalcSheet
Represents a single computed Excel worksheet.
Methods
| Method | Description | ||
|---|---|---|---|
rows() -> int |
Returns the maximum number of rows containing data. | ||
cols() -> int |
Returns the maximum number of columns containing data. | ||
cell(ref) -> Any |
Retrieves the computed value of a cell, either by "A1" format or [col, row] coordinates. |
License
MIT License
Copyright (c) 2025 Alexandre Bento Freire
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file calc_workbook-0.1.0.tar.gz.
File metadata
- Download URL: calc_workbook-0.1.0.tar.gz
- Upload date:
- Size: 4.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b59ec6429ad2af62eb50d820461dacaf69738f0fcc38ad22e3663e97f527fd7a
|
|
| MD5 |
8c2212778c2133460403d3fcca049cc1
|
|
| BLAKE2b-256 |
a1b6a7bc332dbdf4ea131c85bbde85569d855f1152b0c2f2ed5179443f889836
|
File details
Details for the file calc_workbook-0.1.0-py3-none-any.whl.
File metadata
- Download URL: calc_workbook-0.1.0-py3-none-any.whl
- Upload date:
- Size: 4.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9a3503dac0cf3330f11bbdfd282462fa2c8f3d316b5145746d8a6e7500e0acd0
|
|
| MD5 |
de2c7ceb2f9b73a08c260d847da31e7d
|
|
| BLAKE2b-256 |
5571cec0567e0a783ed428a444e3b67470eff460e54871451292943665dd4ea4
|