wiki:Notes/PythonOfficeApps

Python Office Applications

A collection links and info about Python spreadsheets, notebooks, libraries for OpenOffice/Word/Excel compatibility, etc. Any applications suitable for a small business or home office that don't depend directly on Open Office.

The category also includes links about simple validation engines and inference engines, such as they are. Many projects have become inactive.

Spreadsheets

OpenPyXL

https://pypi.python.org/pypi/openpyxl

... 2017-01-31 173KB ...

http://openpyxl.readthedocs.io/en/default/

Openpyxl is a Python library for reading and writing Excel 2010 xlsx/xlsm/xltx/xltm files.

from openpyxl import Workbook
wb = Workbook()

# grab the active worksheet
ws = wb.active

# Data can be assigned directly to cells
ws['A1'] = 42

# Rows can also be appended
ws.append([1, 2, 3])

# Python types will automatically be converted
import datetime
ws['A2'] = datetime.datetime.now()

# Save the file
wb.save("sample.xlsx")

Simple example -> https://code.tutsplus.com/tutorials/how-to-work-with-excel-documents-using-python--cms-25698

More extensive examples -> https://automatetheboringstuff.com/chapter12/

https://manns.github.io/pyspread/

... Pyspread expects Python expressions in its grid cells, which makes a spreadsheet specific language obsolete. Each cell returns a Python object that can be accessed from other cells. These objects can represent anything including lists or matrices.

Google Spreadsheets Python API -> https://github.com/burnash/gspread

https://pypi.python.org/pypi?%3Aaction=search&term=spreadsheet

Logical Spreadsheets

This category verges on a validation/interference engine, if done correctly.

A really simple example.

A < 3 A = 3 A > 3
B = 'This' C = 'OK' C = 'OK' C = 'NotOK'
B = 'That' C = 'NotOK' C = 'OK' C = 'OK'

Simple flow for lookup, but more complex in that each result cell can be a Python script referencing other worksheet cells, producing a primitive form of backchaining and defaulting over ranges of cells ( such as when A or B is Unknown or the result values are redundant over several cells.

Sometimes, defaulting and redundancy can be handled using variations of Python functional programming.

PythonTools#IPython notebooks are powerful ( Python in cells ) and a pretty easy to use as an integration tool.

IPython requires a fair number of packages to install correctly, but they are 'good' dependencies in themselves. Lots of functionality. Might become a 'must-have' component.

https://michigancomputes.wordpress.com/2013/05/10/data-analysis-the-ipython-notebook-way-in-a-single-day/

... Now, in the past, installing the IPython Notebook and all of its dependencies has been really difficult. Thanks to resources like Enthought and Anaconda, the install process is streamlined. ...

... openpyxl is for reading in excel spreadsheets. statlib is for statistical analyses ...

Starting overlap scientific Python toolsets.

pyDatalog - > https://sites.google.com/site/pydatalog/home

Datalog excels at managing complexity. Datalog programs are shorter than their Python equivalent, and Datalog statements can be specified in any order, as simply as formula in a spreadsheet.

Simple Automation Tools And Techniques

https://automatetheboringstuff.com/ - good book

Also See

PythonOpenOffice - Python tools specific to OpenOffice

Last modified 3 months ago Last modified on 02/11/2017 03:09:41 PM