Python in a spreadsheet

B

beliavsky

Is it possible to call a Python function from Calc (the Open Office
spreadsheet) or Microsoft Excel? Are their web sites or books
describing how to do this?

I would prefer not to write any more VBA :).
 
M

Martin Franklin

Is it possible to call a Python function from Calc (the Open Office
spreadsheet) or Microsoft Excel? Are their web sites or books
describing how to do this?

I would prefer not to write any more VBA :).

Yes to both I believe... the first with the python openoffice bridge
Python-UNO

google for 'python openoffice' scores about 115000 hits

The second would I guess be do-able with the win32 extensions.....

google 'win32 extensions python' about 34000 hits

Happy reading...
Martin.
 
M

Michel Claveau/Hamster

Hi !

I do it, from Excel, with an Python-COM-server (thanks Mark Hammond) and the
aspect "dynamic" of the Python language.


Michel Claveau
 
N

Nick Vargish

Is it possible to call a Python function from Calc (the Open Office
spreadsheet) or Microsoft Excel? Are their web sites or books
describing how to do this?

You could check out the latest version of StarOffice from Sun (version
7, I believe) -- apparently it has Python scripting support built-in.

I found that pretty interesting... Isn't Sun committed to something
called Joe or Java or something like that?

Nick
 
T

Thomas Guettler

Am Mon, 15 Dec 2003 13:18:21 -0800 schrieb beliavsk:
Is it possible to call a Python function from Calc (the Open Office
spreadsheet) or Microsoft Excel? Are their web sites or books
describing how to do this?

I would prefer not to write any more VBA :).

I once posted a way to batch convert
files into a different format with pyuno.
Maybe this helps you
http://groups.google.com/[email protected]

Depending on your problem, I would suggest to use
XML instead. I think it is more stable to export
the office file to XML, process it with your script,
and import it again. The remote procedure call solutions
(COM, pyUNO) don't scale well.

thomas
 
J

Jere Kahanpaa

Thomas Guettler said:
Depending on your problem, I would suggest to use
XML instead. I think it is more stable to export
the office file to XML, process it with your script,
and import it again. The remote procedure call solutions
(COM, pyUNO) don't scale well.

Note that the OpenOffice.org native format (sx? files) are nothing but
zipped XML files:

[kahanpaa@nosuchaddress ~/diptera]$ unzip -l brachycera.sxc
Archive: brachycera.sxc
Length Date Time Name
-------- ---- ---- ----
28 12-09-03 17:37 mimetype
281295 12-09-03 17:37 content.xml
29859 12-09-03 17:37 styles.xml
1007 12-09-03 17:37 meta.xml
8779 12-09-03 17:37 settings.xml
750 12-09-03 17:37 META-INF/manifest.xml
-------- -------
321718 6 files

You could manipulate them directly using Python's XML facilities.

Jere
 
J

John J. Lee

Thomas Guettler said:
Am Mon, 15 Dec 2003 13:18:21 -0800 schrieb beliavsk: [...]
Depending on your problem, I would suggest to use
XML instead. [...]
and import it again. The remote procedure call solutions
(COM, pyUNO) don't scale well.

Really? What problems did you have?


John
 
J

John J. Lee

Nick Vargish said:
You could check out the latest version of StarOffice from Sun (version
7, I believe) -- apparently it has Python scripting support built-in.

I found that pretty interesting... Isn't Sun committed to something
called Joe or Java or something like that?

Yeah, but that's for the "enterprise technologists" -- I could think
of another word for them, though <wink>.


John
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,780
Messages
2,569,610
Members
45,254
Latest member
Top Crypto TwitterChannel

Latest Threads

Top