Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/dgorissen/pycel
A library for compiling excel spreadsheets to python code & visualizing them as a graph
https://github.com/dgorissen/pycel
Last synced: about 1 month ago
JSON representation
A library for compiling excel spreadsheets to python code & visualizing them as a graph
- Host: GitHub
- URL: https://github.com/dgorissen/pycel
- Owner: dgorissen
- License: gpl-3.0
- Created: 2011-10-19T10:07:12.000Z (about 13 years ago)
- Default Branch: master
- Last Pushed: 2024-06-06T17:39:32.000Z (6 months ago)
- Last Synced: 2024-10-01T16:37:09.952Z (2 months ago)
- Language: Python
- Homepage:
- Size: 2.12 MB
- Stars: 566
- Watchers: 25
- Forks: 148
- Open Issues: 21
-
Metadata Files:
- Readme: README.rst
- Changelog: CHANGES.rst
- Contributing: .github/CONTRIBUTING.md
- License: LICENSE.txt
Awesome Lists containing this project
- my-awesome-github-stars - dgorissen/pycel - A library for compiling excel spreadsheets to python code & visualizing them as a graph (Python)
- jimsghstars - dgorissen/pycel - A library for compiling excel spreadsheets to python code & visualizing them as a graph (Python)
README
Pycel
=====|build-state| |coverage| |requirements|
|pypi| |pypi-pyversions| |repo-size| |code-size|
Pycel is a small python library that can translate an Excel spreadsheet into
executable python code which can be run independently of Excel.The python code is based on a graph and uses caching & lazy evaluation to
ensure (relatively) fast execution. The graph can be exported and analyzed
using tools like `Gephi `_. See the contained example
for an illustration.Required python libraries:
`dateutil `_,
`networkx `_,
`numpy `_,
`openpyxl `_,
`ruamel.yaml `_, and optionally:
`matplotlib `_,
`pydot `_The full motivation behind pycel including some examples & screenshots is
described in this `blog post `_.Usage
======Download the library and run the example file.
**Quick start:**
You can use binder to see and explore the tool quickly and interactively in the
browser: |notebook|**The good:**
All the main mathematical functions (sin, cos, atan2, ...) and operators
(+,/,^, ...) are supported as are ranges (A5:D7), and functions like
MIN, MAX, INDEX, LOOKUP, and LINEST.The codebase is small, relatively fast and should be easy to understand
and extend.I have tested it extensively on spreadsheets with 10 sheets & more than
10000 formulae. In that case calculation of the equations takes about 50ms
and agrees with Excel up to 5 decimal places.**The bad:**
My development is driven by the particular spreadsheets I need to handle so
I have only added support for functions that I need. However, it is should be
straightforward to add support for others.The code does currently support cell references so a function like OFFSET works,
but suffers from the fact that if a cell is not already compiled in, then the
function can fail. Also, for obvious reasons, any VBA code is not compiled
but needs to be re-implemented manually on the python side.**The Ugly:**
The resulting graph-based code is fast enough for my purposes but to make it
truly fast you would probably replace the graph with a dependency tracker
based on sparse matrices or something similar.Excel Addin
===========It's possible to run pycel as an excel addin using
`PyXLL `_. Simply place pyxll.xll and pyxll.py in the
lib directory and add the xll file to the Excel Addins list as explained in
the pyxll documentation.Acknowledgements
================This code was originally made possible thanks to the python port of
Eric Bachtal's `Excel formula parsing code
`_
by Robin Macharg.The code currently uses a tokenizer of similar origin from the
`openpyxl library.
`_.. Image links
.. |build-state| image:: https://travis-ci.com/dgorissen/pycel.svg?branch=master
:target: https://travis-ci.com/dgorissen/pycel
:alt: Build Status.. |coverage| image:: https://codecov.io/gh/dgorissen/pycel/branch/master/graph/badge.svg
:target: https://codecov.io/gh/dgorissen/pycel/list/master
:alt: Code Coverage.. |pypi| image:: https://img.shields.io/pypi/v/pycel.svg
:target: https://pypi.org/project/pycel/
:alt: Latest Release.. |pypi-pyversions| image:: https://img.shields.io/pypi/pyversions/pycel.svg
:target: https://pypi.python.org/pypi/pycel.. |requirements| image:: https://requires.io/github/stephenrauch/pycel/requirements.svg?branch=master
:target: https://requires.io/github/stephenrauch/pycel/requirements/?branch=master
:alt: Requirements Status.. |repo-size| image:: https://img.shields.io/github/repo-size/dgorissen/pycel.svg
:target: https://github.com/dgorissen/pycel
:alt: Repo Size.. |code-size| image:: https://img.shields.io/github/languages/code-size/dgorissen/pycel.svg
:target: https://github.com/dgorissen/pycel
:alt: Code Size.. |notebook| image:: https://mybinder.org/badge.svg
:target: https://mybinder.org/v2/gh/dgorissen/pycel/master?filepath=notebooks%2Fexample.ipynb
:alt: Open Notebook