[Pythonmac-SIG] accessing .xsl files

Jack Jansen Jack.Jansen@oratrix.com
Thu, 10 Apr 2003 22:11:13 +0200


On donderdag, apr 10, 2003, at 20:15 Europe/Amsterdam, Tracy S. Ruggles 
wrote:

> Is there a mac python module that could do something like this (or a 
> module or two that I could use to create an interface like this):
>
> # --- samply.py
> import osax
>
> ExcelProxy = osax.Application('Microsoft Excel')
> # 2 options
> range = ExcelProxy.tell("return Range 'A1:F12' from Document 1")
> range = ExcelProxy.Document(1).Range('A1','F12')
>
> data = range.Value

Possibly this will work with Python from CVS. I've been pounding hard 
on the Python OSA
implementation, and the things I've tried work. But: I don't have 
Excel, so I can't test it.

If you would be willing to get Python from the CVS repository and build 
the framework installation
there will be (very minimal) help in the MacPython Help. Basically, 
first you generate the
proxy module in the IDE with the new "Generate OSA Suite..." command. 
Tell it where excel
is and it generates the interface module. Then you should be able to do 
something like

import Excel

excel = Excel.Excel()
data = excel.get(Excel.Document().Range('A1:F12').Value)

But: using the OSA modules with anything else than what I've tried 
you're threading new ground, so there's a good chance you run into 
bugs. But as I think OSA is very important to Python I promise to fix 
them quickly. And if you find enough bugs I'll add your name to the 
list of Python contributors:-)
--
- Jack Jansen        <Jack.Jansen@oratrix.com>        
http://www.cwi.nl/~jack -
- If I can't dance I don't want to be part of your revolution -- Emma 
Goldman -