The TRUE Python Spreadsheet Macro Class
The Code has undergone significant revisions and will now always be hosted here:
https://sourceforge.net/projects/pyworkbooks/files/
I recommend you view the documentation included there.
So there is a post I made not too long ago about the python addon for Gnumeric. All the information there is still valid, but the program just got a WHOLE LOT better
I don't have a ton of time to give a long example now, but there is a tutorial included with the file. Basically it allows for COMPLETE (and I mean complete) control of your entire workbook through python, even through the built-in interpreter if you run a few commands. There are only three things you need to know to edit any cell in your spreadsheet If you follow the macro, you can have an object called gBook. This is the object that represents your worksheet.gBook.change_sheet(sheetobject) can be passed an integer, a string, or a cell -- it will change your currently active sheet to that cell. So if you have a sheet called "sandbox" and you say gBook.change_sheet("sandbox") then you can start editing the sheet sandbox! gBook.change_range( tuple or cell_range) will change the reference cell. For playing around you should just set it to (0,0) -- like thisgBook.change_range( (0,0) )now lets say you wanted to read the first 10 columns in the first row. Just type: data = gBook[0, :9]or
data = gBook["A1:A:10"]This will return a generator object. To change it into your data-type of choice (mine is a tuple) just typedata = tuple(data)and there you have it! You have your data.