What is the best data structure for a very simple spreadsheet?

mdipierro massimodipierro71 at gmail.com
Sun Jan 3 22:40:19 CET 2010


Perhaps this can be useful:
http://www.web2py.com/examples/spreadsheet

The code is in a single file with not dependencies and it does not
require web2py to run:
http://code.google.com/p/web2py/source/browse/gluon/contrib/spreadsheet.py

Here is a sample controller that shows you how to embed the
spreadsheet in web page:
http://code.google.com/p/web2py/source/browse/applications/examples/controllers/spreadsheet.py

Massimo



On Jan 3, 5:27 am, vsoler <vicente.so... at gmail.com> wrote:
> Hi,
>
> Not sure this is the best group to post, but I cannot think of any
> other.
>
> My application would contain a limited set of "cells" represented by
> the instances of a Cell class:
>
> class Cell:
> ...
>
> A1=Cell(7)
> A2=Cell(2*A1)
> A3=Cell(3*A1+A2)
> A4=Cell(A3*4)
>
> Of course, A1 = 7, A2 = 14, A3 = 35 and A4 = 140
>
> Now, I somehow want to be able to show a dependency tree
>
> 1 level dependency trees
>   A1: None
>   A2: A1
>   A3: A1, A2
>   A4: A3
>
> All levels dependency trees
>
>   A1: None
>   A2: A1
>   A3: A1, A2
>   A4: A3, A2, A1
>
> Leaf + values dependency trees:
>
>   A1: 7
>   A2: A1=7, 2
>   A3: 3, A1=7, 2
>   A4: 3, A1=7, 2, 4
>
> What I'd like to know is:
>
> 1) what are, in your opinion, the basic elements of the Cell class?
> 2) Do I need a parser to evaluate the formulas like “3*A1+A2”? Can you
> recommend one library that already contains one?
> 3) Do I need a tree data structure to represent my data? would the
> tree be an attribute of the class instance?
>
> I imagine a lot can be said on these questions. What I am looking for
> is some hints that help me get out of where I am now.
>
> Any help is highly appreciated.
>
> Vicente Soler




More information about the Python-list mailing list