Skip to main content

Simple spreadsheet extension for reStructuredText tables.

Project description

Register a simplespreadsheet directive to do calculations in a table.


pip install rst_simplespreadsheet  # or
easy_install rst_simplespreadsheet


Use it as an extension to rst2pdf:

rst2pdf -e rst_simplespreadsheet ...


Formulae are pieces of text enclosed in ={…}. Only one formula per cell is supported.

The simplest formula is a number, like this:


This define the cell value to 4. A cell has value 0 (zero) unless it contains a formula.

You can reference the value of other cells using alphanumerical identifiers. Columns are identified using letters, from a to z then from aa to az, ba to bz and so on. Rows are identified using numbers. The first row is 1 and header rows are not numbered (thus not referenceable).

For example, the formula to calculate the product of cells a1 and a2 is:

={a1 * a2}

There are two special characters, # and @, used to reference the current row and the current column, respectively.

For example, to calculate the product of cells b and f on the current row:

={b# * f#}

and to calculate the sum of rows 1 and 2 in the current column:

={@1 + @2}


The spreadsheet can calculate cell values using Python functions. These functions have to be defined and registered in the SpreadSheet class first.

For now, only the function sum is defined:



You can do a simple table with totals like this one:

Qty Rate Price
2 1 $ 2 $
4 3 $ 12 $
1 5 $ 5 $
3 7 $ 21 $
Total 40 $

with this code:

.. simplespreadsheet::
    | Qty  | Price  |  Total            |
    | ={2} | ={1} $ | ={a# * b#} $      |
    | ={4} | ={3} $ | ={a# * b#} $      |
    | ={1} | ={5} $ | ={a# * b#} $      |
    | ={3} | ={7} $ | ={a# * b#} $      |
    | *Total*       | ={sum("c1:c4")} $ |

Adding more functions

For now, the only available function is sum(). You can easily add new functions by adding them to Please share your improvements by forking the project on github:

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for rst_simplespreadsheet, version 0.1.1
Filename, size File type Python version Upload date Hashes
Filename, size rst_simplespreadsheet-0.1.1.tar.gz (4.0 kB) File type Source Python version None Upload date Hashes View

Supported by

Pingdom Pingdom Monitoring Google Google Object Storage and Download Analytics Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page