By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
457,900 Members | 1,337 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 457,900 IT Pros & Developers. It's quick & easy.

Python in a spreadsheet

P: n/a
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 :).
Jul 18 '05 #1
Share this Question
Share on Google+
7 Replies


P: n/a
On Mon, 2003-12-15 at 21:18, be*******@aol.com wrote:
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.


--
Martin Franklin <mf********@gatwick.westerngeco.slb.com>
Jul 18 '05 #2

P: n/a
Hi !

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

Jul 18 '05 #3

P: n/a
be*******@aol.com writes:
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

--
# sigmask || 0.2 || 20030107 || public domain || feed this to a python
print reduce(lambda x,y:x+chr(ord(y)-1),' Ojdl!Wbshjti!=obwAcboefstobudi/psh?')
Jul 18 '05 #4

P: n/a
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/gr*********...as-guettler.de

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

Jul 18 '05 #5

P: n/a
Thomas Guettler <gu*****@thomas-guettler.de> wrote:
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
--
Lord, make my words as sweet as honey, for one day I may have to eat them
- Daryl Benson
Jul 18 '05 #6

P: n/a
"Thomas Guettler" <gu*****@thomas-guettler.de> writes:
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
Jul 18 '05 #7

P: n/a
Nick Vargish <na*******@bandersnatch.org> writes:
be*******@aol.com writes:
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?


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

This discussion thread is closed

Replies have been disabled for this discussion.