Skip to main content

calc-workbook

PyPI Version Python Versions

calc-workbook is an easy-to-use Python library that loads Excel files, computes all formulas using the formulas engine, and provides a clean, high-level API to access computed cell values from each sheet.

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 File

A B
1 10 5
2 20 15
3 =A1+A2 =B1*B2

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") 
# Access first sheet
sheet = wb.get_sheet() 

# Retrieve computed values
print("A1:", sheet.cell("A1"))        # 10
print("A1:", sheet.cell([1, 1]))      # 10
print("A2:", sheet.cell("A2"))        # 20
print("A3:", sheet.cell("A3"))        # 30

# Get sheet dimensions
print("Rows:", sheet.rows())          # 3
print("Cols:", sheet.cols())          # 2

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.

Metadata

Release files for calc-workbook 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for calc-workbook 0.1.1
File Size Uploaded
calc_workbook-0.1.1.tar.gz 4.6 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for calc-workbook 0.1.1
File Interpreter ABI Platform
calc_workbook-0.1.1-py3-none-any.whl Python 3 none any Details

Total release size: 9.1 kB

Release files / calc_workbook-0.1.1.tar.gz

Download URL calc_workbook-0.1.1.tar.gz
Size 4.6 kB
Tags Source
SHA-256 checksum
How to use checksums
29d6c56c721f9e8ba02cdaea2232cae81b0c8426a9dc3ece8424f1fbd73ab2ed
BLAKE2b-256 checksum
How to use checksums
33374999be61b168cfebe394684f72180a1daf096b1d7a80162568d388c5da3a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.3

Release files / calc_workbook-0.1.1-py3-none-any.whl

Download URL calc_workbook-0.1.1-py3-none-any.whl
Size 4.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
f9469de578f87b9e153113f7848e2b44049c41fc4b7a3527e3b42a3cc7a971a9
BLAKE2b-256 checksum
How to use checksums
85dd8b9e2efcf66c4597d842fcbea07958025e7358d1b0caf4ffe47be88b8435
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.3

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page