473,652 Members | 2,935 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Programming Language that is Spreadsheet/Table Based

I'm looking for a programming language or module that sorta looks and
feels like MS Excel (I love and think in tables), yet has the power and
open-endedness of python or javascript. I'm still pretty new to
python.

any ideas? i've been having some fun with VBA in excel, but I want
something I can save as en exe and call my own creation, y'know?

Nov 3 '06 #1
10 2189

Omar wrote:
I'm looking for a programming language or module that sorta looks and
feels like MS Excel (I love and think in tables), yet has the power and
open-endedness of python or javascript. I'm still pretty new to
python.

any ideas? i've been having some fun with VBA in excel, but I want
something I can save as en exe and call my own creation, y'know?
I think you'll have to build it. For .NET there are lots of third party
grids available and a native one as well. You may want to look at the
grid supplied with wxPython.

Spreadsheets are effectively interfaces to functional programming, so
this request isn't as odd as it may seem to some.

You probably want to have a look at the PyCells project which can
handle the dependency tracking you will need: which is harder than you
might think.

Fuzzyman
http://www.voidspace.org.uk/python/index.shtml

Nov 3 '06 #2
MC
Hi!

You can expand VBA/Excel with Python, with Pywin32 for to make a
dynamic COM server.

--
@-salutations

Michel Claveau
Nov 3 '06 #3
Omar wrote:
I'm looking for a programming language or module that sorta looks and
feels like MS Excel (I love and think in tables), yet has the power and
open-endedness of python or javascript. I'm still pretty new to
python.

any ideas? i've been having some fun with VBA in excel, but I want
something I can save as en exe and call my own creation, y'know?
More than the implementation, I would be curious about the API you (or
anyone else) might envision. I have spent a lot of time making a "Table"
class over about the last year and a half, but I'm not sure what might
be an intuitive interface for most people. First, I think it should work
like a "sorted" dictionary of lists, but, at the same time, a list of
sorted dictionaries. I also want *shorthand* for selection.

For example, does the output below look like an intuitive interface? Or,
more likely, how many people get squeamish when they see this interface?
Do these squeamish people have any better ideas? This is a taste of how
my Table class currently behaves:

pyprint t # dependent on its property t.format
Last First Age
Barker Bob 204
Burnet Carol 64
Danson Ted 54
Cooper Alice 78
pyt.headings()
("Last", "First", "Age")
pyt.get_row(1) # approximately equal clarity with 1d slice
['Burnet', 'Carol', 64]
pyt[1] # implicit selection of "first" dimension
['Burnet', 'Carol', 64]
pyt.get_column( 'Last') # probably clearer than taking a 1d slice
['Barker', 'Burnet', 'Danson', 'Cooper']
py# the following is probably the trickiest, should it return a Table
py# should it be illegal?
py# should t['Last'] be the way to take the "slice" and get the col?
pyt[None, 'Last'] # 1d slice returns list (2nd dim. explicit)
['Barker', 'Burnet', 'Danson', 'Cooper']
pyt2 = t[1:3, ('First', 'Age')] # 2d slice returns a new Table
pyt2
<__main__.Tab le instance at 0x404f676c>
pyt2.format
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
AttributeError: 't2' object has no attribute 'format'
pyt2.format = "%10s %4d"
pyprint t2
First Age
Carol 64
Ted 54
pyt3 = t[1:3,'First':'Ag e'] # shorthand to take a swath of columns
pyt3.format = "%10s %4d"
pyprint t3
First Age
Carol 64
Ted 54
pyt3 = t[1:3, 0:2] # if we know what column numbers we want instead
pyt3.format = "%10s%10s"
pyprint t3
Last First
Burnet Carol
Danson Ted

These latter selections might turn some heads, especially for those who
think a a little too deeply about dictionaries. But, unlike a
dictionary, a Table is ordered. If you disagree with the assumption that
tables are ordered, make a table in excel, save it, close it, open it
again and see that the columns are still in the same order. Do this 1000
times to convince yourself. The table will be in the same order every
time! Amazing!

The idea is that tables are not dictionaries--please resist drawing
paralells. If we strangle ourselves with operating under the dictionary
paradigm, we will never get a Table. Trust me, I've thought about it
more than most. (If you want a Table to act like a dictionary, I can
make a RandomTable class just for you.)

Notice also that slicing can be done with a tuple or a list, so type
checking is done in the implementation--but lets forget about our
notions of impementation and how type checking is "bad". I want to get
feedback on the API here without regard to how it might be implemented.

In a Table, the first dimension is row and the second is column (i.e.
the data is organized by rows). My Table class has a lot of additional
functionality. But, I'm curious about how people see such a beast
working, though. Please don't criticize unless you have a better idea
about the API of a Table. I want to hear genuine and concrete ideas and
not abstruse pontification about programming or design! Statements of "I
wouldn't do this thing here" should be immediately followed by
"--rather, I would do this other thing for which I've created a concrete
example below."

If you think this interface is genius, well my ego wants to hear about
that as well, but its not terribly necessary.

James

--
James Stroud
UCLA-DOE Institute for Genomics and Proteomics
Box 951570
Los Angeles, CA 90095

http://www.jamesstroud.com/
Nov 4 '06 #4

James Stroud wrote:
I have spent a lot of time making a "Table"
class over about the last year and a half, but I'm not sure what might
be an intuitive interface for most people. First, I think it should work
like a "sorted" dictionary of lists, but, at the same time, a list of
sorted dictionaries. I also want *shorthand* for selection.

For example, does the output below look like an intuitive interface? Or,
more likely, how many people get squeamish when they see this interface?
Do these squeamish people have any better ideas? This is a taste of how
my Table class currently behaves:

pyprint t # dependent on its property t.format
Last First Age
Barker Bob 204
Burnet Carol 64
Danson Ted 54
Cooper Alice 78
pyt.headings()
("Last", "First", "Age")
pyt.get_row(1)
['Burnet', 'Carol', 64]
pyt[1]
['Burnet', 'Carol', 64]
pyt.get_column( 'Last')
['Barker', 'Burnet', 'Danson', 'Cooper']
+1 from me up to here
py# the following is probably the trickiest, should it return a Table
py# should it be illegal?
py# should t['Last'] be the way to take the "slice" and get the col?
pyt[None, 'Last'] # 1d slice returns list (2nd dim. explicit)
['Barker', 'Burnet', 'Danson', 'Cooper']
I can imagine manipulating columns at the Table creation stage -
insert, append, delete column - but after that I think you would be
dealing with rows more often. Personally, if I needed columns I would
be happier with a list comprehension:

[ (row['Last'], row['Age']) for row in t ] etc.

eg. like:

http://buzhug.sourceforge.net/
pyt2 = t[1:3, ('First', 'Age')] # 2d slice returns a new Table
pyt3 = t[1:3,'First':'Ag e'] # shorthand to take a swath of columns
pyt3 = t[1:3, 0:2] # if we know what column numbers we want instead
t[1:3][0:2] and so on would be more intuitive to me, possibly
t[1:3]['First':'Age']
Please don't criticize unless you have a better idea
about the API of a Table. I want to hear genuine and concrete ideas and
not abstruse pontification about programming or design! Statements of "I
wouldn't do this thing here" should be immediately followed by
"--rather, I would do this other thing for which I've created a concrete
example below."
chill...

Gerard

Nov 4 '06 #5
Gerard Flanagan wrote:
>py# the following is probably the trickiest, should it return a Table
py# should it be illegal?
py# should t['Last'] be the way to take the "slice" and get the col?
pyt[None, 'Last'] # 1d slice returns list (2nd dim. explicit)
['Barker', 'Burnet', 'Danson', 'Cooper']

I can imagine manipulating columns at the Table creation stage -
insert, append, delete column - but after that I think you would be
dealing with rows more often. Personally, if I needed columns I would
be happier with a list comprehension:
[ (row['Last'], row['Age']) for row in t ]
etc.
To make a table from list comprehension in this way seems like it would
require some redundancy because a list comprehension only gets you a
list (of rows or lists). It seems if you wanted to work with your 2d
selection of data, then you would want to get a table back:

data = [ (row['Last'], row['Age']) for row in t ]
t2 = Table(('Last',' Age'), data)

This seems, to me, to separates selection in the 2 dimensions and makes
it "backwards" :

data = [ (row['Last'], row['Age']) for row in t[1:3]]
t2 = Table(('Last',' Age'), data)

So a function would be needed to group the selection in a way that
reflects the organization of the table:

t2 = t.subtable((1,3 ), ('Last','Age'))

But then, since the latter seems a natural consequence of using list
comprehension for selection, how might one distinguish a range of
columns if not by a verbose function name?

t2 = t.subtable_with _column_range(( 1,3), ('Last','Age'))

The concept of slicing seems to take care of this. Maybe

t2 = t.subtable(slic e(1,3), slice('Last','A ge'))

But this begins to seem awkward and verbose to boot. Any suggestions on
adapting your idea of list comprehension to generate subtables?

eg. like:

http://buzhug.sourceforge.net/
>pyt2 = t[1:3, ('First', 'Age')] # 2d slice returns a new Table
pyt3 = t[1:3,'First':'Ag e'] # shorthand to take a swath of columns
pyt3 = t[1:3, 0:2] # if we know what column numbers we want instead

t[1:3][0:2] and so on would be more intuitive to me, possibly
t[1:3]['First':'Age']
This looks better than my slicing, and to argue with it I'd have to
break my own rules and point out that it would require making an
intermediate table in the implementation. I am emulating numarray
slicing closely, which itself is probably focused on implementation and
speed.
James
Nov 4 '06 #6
James Stroud wrote:
Gerard Flanagan wrote:
py# the following is probably the trickiest, should it return a Table
py# should it be illegal?
py# should t['Last'] be the way to take the "slice" and get the col?
pyt[None, 'Last'] # 1d slice returns list (2nd dim. explicit)
['Barker', 'Burnet', 'Danson', 'Cooper']
I can imagine manipulating columns at the Table creation stage -
insert, append, delete column - but after that I think you would be
dealing with rows more often. Personally, if I needed columns I would
be happier with a list comprehension:
[ (row['Last'], row['Age']) for row in t ]
etc.

To make a table from list comprehension in this way seems like it would
require some redundancy because a list comprehension only gets you a
list (of rows or lists). It seems if you wanted to work with your 2d
selection of data, then you would want to get a table back:

data = [ (row['Last'], row['Age']) for row in t ]
t2 = Table(('Last',' Age'), data)

This seems, to me, to separates selection in the 2 dimensions and makes
it "backwards" :

data = [ (row['Last'], row['Age']) for row in t[1:3]]
t2 = Table(('Last',' Age'), data)

So a function would be needed to group the selection in a way that
reflects the organization of the table:

t2 = t.subtable((1,3 ), ('Last','Age'))

But then, since the latter seems a natural consequence of using list
comprehension for selection, how might one distinguish a range of
columns if not by a verbose function name?

t2 = t.subtable_with _column_range(( 1,3), ('Last','Age'))

The concept of slicing seems to take care of this. Maybe

t2 = t.subtable(slic e(1,3), slice('Last','A ge'))

But this begins to seem awkward and verbose to boot. Any suggestions on
adapting your idea of list comprehension to generate subtables?
What about symmetric 'load' and 'iterrows' methods for the Table class:

t2 = Table()
t2.load( t1.iterrows("La stName", "Age") )

def load(self, iterable):
'''expecting tuples'''
for lname, age in iterable:
self.append( lname, age )

def iterrows(self, *args):
'''returns a generator which itself returns tuples
filtered by the column names in *args (via
operator.itemge tter maybe?)'''
There might be some value in comparing Microsoft's DataSet API. IIRC,
you typically have:

*UI* - DataView - DataSet - DataAdapter - *DATABASE*

A DataSet is a collection of DataTables and has a lot of DB/XML
functionality and so on. A DataView on the other hand is more
lightweight and has mainly filtering and sorting functions and is
designed to be bound to a GUI widget such as a DataGrid.

You might have something along the lines of:

ds = DataSet()
# fill ds from datasource
dt_customers = ds.tables["customers"]
view = DataView( dt_customers )
view.rowfilter = "lastname LIKE 'A*' and Age < 60"

I'm not saying imitate this, but maybe some value in studying the
OO-bondage approach.

All the best

Gerard

Nov 4 '06 #7
Gerard Flanagan wrote:
What about symmetric 'load' and 'iterrows' methods for the Table class:

t2 = Table()
t2.load( t1.iterrows("La stName", "Age") )

def load(self, iterable):
'''expecting tuples'''
for lname, age in iterable:
self.append( lname, age )

def iterrows(self, *args):
'''returns a generator which itself returns tuples
filtered by the column names in *args (via
operator.itemge tter maybe?)'''
There might be some value in comparing Microsoft's DataSet API. IIRC,
you typically have:

*UI* - DataView - DataSet - DataAdapter - *DATABASE*

A DataSet is a collection of DataTables and has a lot of DB/XML
functionality and so on. A DataView on the other hand is more
lightweight and has mainly filtering and sorting functions and is
designed to be bound to a GUI widget such as a DataGrid.

You might have something along the lines of:

ds = DataSet()
# fill ds from datasource
dt_customers = ds.tables["customers"]
view = DataView( dt_customers )
view.rowfilter = "lastname LIKE 'A*' and Age < 60"

I'm not saying imitate this, but maybe some value in studying the
OO-bondage approach.

Thank you, this is very good stuff to think about.

James
Nov 4 '06 #8
"James Stroud" <js*****@mbi.uc la.eduwrote:
Gerard Flanagan wrote:
8<----------------------------------------------
Thank you, this is very good stuff to think about.

James
I can't really add to the above train of thought...

And I don't know if this will help - but if you want to think, here is a skewed,
simple view:

If I were to try and do something like this, I would start by defining a spread
sheet like dict to keep everything in, using (column,row) tuples as keys, and
build on top of that.

This would give you the ability to keep *anything* in a cell, and the database
like structures you are thinking of would live on top of this underlying access
structure, with the (column,row) being a direct *pointer* to an element in one
fast step.

I would then also use other dicts to describe what is kept in the "columns" -
something simple like:

header_dict = {0:['name of person','Name', 'Enter your name'],1:['age of person
since birth','Age','E nter your birthday'], ... }

where the first item in the list is a help string, the second a column header
for printing, the third the string to use as prompt for a GUI, etc... - you
could even keep and enforce type if you wanted to - must be int, must be date,
column width for printing, validation data and rules, - whatever.

In a sense this is a sort of inverted way of looking at a file - instead of
having an underlying dict with (column, row) keys, you could alternatively have
"loose" column dicts only to keep the data in ( note that I have been writing
(column, row) consistently, instead of the more conventional (row,column).) -
this would make adding or deleting columns almost trivial.

You *could* also have references to Python functions or class methods living
alongside the data in the cells, and then things can get hairy - for an age
entry, for instance, the cell can look like:

Data[(column,row)] = # (or Age[row] in the alternative
approach)

[(1947,01,24),se lf.BirthdayChec ker,self.Presen tChooser,self.L etterWriter, ...]

where the first entry, the tuple, represents the data (could have been a list
or dict, of course ) and the rest are methods or functions to use, in this
particular instance. You could instead have these function references in the
age column's header dict entry, for those of them that have applicability across
all rows of the column, just like the idea of type enforcement or validation
above.

For a kind of row, or row type, you need then simply keep a list of column
numbers that are required for this "record", with a different list defining a
different record type - Gold members need these column entries filled in, while
Silver members need only those... simple, but then you need a record type
column...

This sort of thing organises the stuff, but the code to use it becomes a bit
impenetrable, as you have to write a kind of crawling process to access the
structure to do what is required, but it is all "table driven" and can be very
flexible. Its not a weekend project though, and when you are finished its a
kind of super relational database...

HTH

- Hendrik

Nov 5 '06 #9
dug

I think that Gnumeric lets you do some python stuff.

Douglas

Omar wrote:
I'm looking for a programming language or module that sorta looks and
feels like MS Excel (I love and think in tables), yet has the power and
open-endedness of python or javascript. I'm still pretty new to
python.

any ideas? i've been having some fun with VBA in excel, but I want
something I can save as en exe and call my own creation, y'know?
Nov 5 '06 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

52
6406
by: Tony Marston | last post by:
Several months ago I started a thread with the title "What is/is not considered to be good OO programming" which started a long and interesting discussion. I have condensed the arguments into a single article which can be viewed at http://www.tonymarston.net/php-mysql/good-bad-oop.html I fully expect this to be the start of another flame war, so sharpen your knives and get stuck in!
7
6021
by: Hugh McLaughlin | last post by:
Hello Everyone and thanks for your help in advance. I am working on an application that requires the parsing of an Excel spreadsheet that will be loaded into a SQL Server table. An example of the spreadsheet is located at: http://ratesheets.sollen.com/script/ratesheets/interfirst/ ratesheets/IFRS1_20030722_094227.xls At the heart of the problem is the sometimes varying layout of the spreadsheet. For example, the application
5
1924
by: Colleyville Alan | last post by:
I need to import a spreadsheet into an Access table. The spreadsheet has performance for mutual funds for various periods. The problem is that if there is no info for a particular period, the spreadsheet contains a dash in the cell (for example if the fun is only 4 years old and I look in the columns for 5-year and 10-year performance). I cannot change the dashes to blank with a global change, the negative numbers would lose the...
4
2298
by: washoetech | last post by:
Hello, I am working on a project where I need to be able to grab the data from an Excel spreadsheet and create a new table in my database based on the columns in the spreadsheet. After the table is created then I need to fill the table with the data from that spreadsheet. I am using ASP.NET 2.0 and SQL 2000 for my database. What would be the best way to do this? Should I go Excel to XML or Excel to a Dataset?
29
2243
by: SG | last post by:
Hi everyone, I am a complete novice at computers and programming and right now, all i need to know is that why do many people prefer C to C++? Is it just because they are used to using C and are conservative about switching over to C++ or is there some other reason? Secondly, could you please tell me how the knowledge of C will help me later on? I have a teacher here who just shrugged at this question and replied that the knowledge of...
38
2664
by: ifti_crazy | last post by:
I am VB6 programmer and wants to start new programming language but i am unable to deciced. i have read about Python, Ruby and Visual C++. but i want to go through with GUI based programming language like VB.net so will you please guide me which GUI based language has worth with complete OOPS Characteristics will wait for the answer
3
5322
by: D.Stone | last post by:
I'm trying to import an Excel spreadsheet into an existing Access table using Office 2003. Ultimately, the plan is to do it programmatically using TransferSpreadsheet, but to check that the file has no problems, I've done it manually with the Import Spreadsheet wizard. The worksheet has 43 rows, and I import a named range defined as "=Sheet1!$C:$E". The import works, but I get a table with 64K rows, all but 43 being blank!
16
2211
by: Malcolm McLean | last post by:
I want this to be a serious, fruitful thread. Sabateurs will be plonked. Table-based programming is a new paradigm, similar to object-orientation, procedural decomposition, or functional programming. The idea is that all the data in the program comes in "tables". A table consists of records and fields, and is thus a 2d entry. Fields may be numbers or strings, and have names, descriptors, prevalidation conditions and postvalidation...
4
1752
by: =?Utf-8?B?Q2FybGl0b3M=?= | last post by:
Hi there, I have a asp.net page that dynamically constructs a table based on data retrieved from a database. This is an excerpt of the code used: ' Create a row Dim row As HtmlTableRow = New HtmlTableRow ' Create a column and add it to the row Dim cell As HtmlTableCell = New HtmlTableCell cell.InnerText = sValue
0
8370
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8283
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
8470
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8590
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7302
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
4147
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4291
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2707
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1914
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.