Excel-formulas-calculator
Excel-formulas-calculator (EFC) is a high-level Py23 library that allows you to calculate Excel formulas on any OS.
Openpyxl interface
from openpyxl import load_workbook
from efc.interfaces.iopenpyxl import OpenpyxlInterface
wb = load_workbook('test.xlsx')
interface = OpenpyxlInterface(wb=wb, use_cache=True)
# e.g. A1 stores formula '=1 + 2', then result = 3
result = interface.calc_cell('A1', 'Worksheet1')
# EFC does not change the source document
print(wb['Worksheet1']['A1'].value) # prints '=1 + 2'
# If you need to replace a formula in a workbook with a value,
# you need to do this
wb['Worksheet1']['A1'].value = interface.calc_cell('A1', 'Worksheet1')
print(wb['Worksheet1']['A1'].value) # prints '3'
# The EFC does not track changes to values in the workbook.
# If the use_cache=True option is used, the calculated formulas
# are not recalculated again when they are accessed.
# e.g. A2 = 2, A3 = 1, A4 = A2 + A3
print(interface.calc_cell('A4', 'Worksheet1')) # prints '3'
wb['Worksheet1']['A2'].value = 1234
print(interface.calc_cell('A4', 'Worksheet1')) # prints '3'
# If you have made changes to the workbook, then you need to reset
# the cache to get up-to-date results
interface.clear_cache()
print(interface.calc_cell('A4', 'Worksheet1')) # prints '1235'
# You can disable caching of results,
# but then when you run a large number of related formulas,
# the calculation speed will decrease significantly
Custom interface
- Inherit from efc.interface.BaseExcelInterface in your excel file class and implement abstract methods. This class will be used to get data from excel file using any library you want.
- Use calc_cell to calculate cell's formula.
Functionality
- Arithmetic:
-, +, *, /, ^, () - Comparison:
<>, >, >=, <, <=, = - String concatenation:
& - Functions:
ABS, AND, AVERAGE, AVERAGEIFS, COLUMN, CONCATENATE, COUNT, COUNTA, COUNTIF, COUNTIFS, COUNTBLANK, FLOOR, IF, IFS, IFERROR, INDEX, ISBLANK, ISERROR, HLOOKUP, LARGE, LEN, LEFT, LOWER, MATCH, MAX, MID, MIN, MOD, NOT, OFFSET, OR, RIGHT, ROUND, ROUNDDOWN, ROW, SEARCH, SMALL, SUBSTITUTE, SUM, SUMIF, SUMIFS, SUMPRODUCT, TRIM, VLOOKUP, YEARFRAC, UNIQUE, UPPER - All variations of the spelling of the cell and range addresses (linked docs will be skipped)
- Formula cell offset - this can be useful when calculating shared formulas
Release files for excel-formulas-calculator 0.5.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| excel_formulas_calculator-0.5.1.tar.gz | 33.8 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| excel_formulas_calculator-0.5.1-py2.py3-none-any.whl | Python 2, Python 3 | none | any | Details |
Total release size: 77.6 kB
Release files / excel_formulas_calculator-0.5.1.tar.gz
| Download URL | excel_formulas_calculator-0.5.1.tar.gz |
|---|---|
| Size | 33.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
939d2ed7745edb37175ca710c23893b2cbfa8c6c7bab3c8b0f37c7e4f61467b9
|
|
BLAKE2b-256 checksum How to use checksums |
0c52f2e841d18b86cca8ec552dc8ef9c11590090ed137bab4fa9c69d4919b5ca
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.12.9
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jul 21, 2025.
Transparency logRelease files / excel_formulas_calculator-0.5.1-py2.py3-none-any.whl
| Download URL | excel_formulas_calculator-0.5.1-py2.py3-none-any.whl |
|---|---|
| Size | 43.7 kB |
| Tags | Python 2 Python 3 |
|
SHA-256 checksum How to use checksums |
06451f80ed534eef94ddf3f99827dbb7c4bf3bef9e55d05d18d929a7c3268e63
|
|
BLAKE2b-256 checksum How to use checksums |
265ccbcd859601d03811fb8ef92bce27970476bb95cf5bc915ac6accb1995099
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.12.9
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jul 21, 2025.
Transparency log