A python server harnessing the calculational ability of LibreOffice Calc (thanks to 'pyoo'). It provides 'instant' access to the cell ranges of a set of spreadsheets.
spreadsheet_server was built to aid rapid web tool development where the logic was already implemented in Microsoft Excel/LibreOffice Calc. Instead of rewriting the logic from scratch, this tool was born.
The tool has been developed to work on a headless GNU/Linux where the server and client are on the same machine.
sudo apt-get update && sudo apt-get upgrade
sudo apt-get install git gcc python3 python3-dev python3-virtualenv libreoffice-calc python3-uno
git clone https://github.com/robsco-git/spreadsheet_server.git
cd spreadsheet_server
mkdir -p ~/.virtualenvs
virtualenv --system-site-packages -p python3 ~/.virtualenvs/spreadsheet_server
source ~/.virtualenvs/spreadsheet_server/bin/activate
pip install -r requirements.txt
python server.py
# Copy spreadsheets (.xlsx, .ods etc) into ./spreadsheets
Place your spreadsheets in './spreadsheets'.
Make sure you have a correctly set up virtualenv the required packages are installed (see below), then run the server:
python server.py
You can also create a SpreadsheetServer object (from server.py) and then call the method 'run' on the object to start the server. This allows the for customisation of the default settings. Have a look in server.py to see what can be set.
example_client.py is provided for an overview of how to use the functions exposed by the client. This is a good place to start.
What is UNO? What is Python-UNO? What is PyOO? The first few paragraphs of the PyOO README should answer most of your questions: https://github.com/seznam/pyoo/blob/master/README.rst
If you symbolically link a spreadsheet itself, the lock files that LibreOffice creates and uses are stored in the directory where the file is located, not in the directory where the symbolic link is located. It is recommended that you place your spreadsheet(s) into a directory and symbolically link that directory into the './spreadsheets' directory. This way, LibreOffice will always be able to locate the lock files it needs. You can use a directory per project if you like.
You can run the all the current tests with 'python -m unittest discover'. Use './coverage.sh' to run the coverage analysis of the current tests and have a look in the generated htmlcov directory. You will need the 'coverage' installed to the virtualenv:
pip install coverage