473,406 Members | 2,336 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

Python in a spreadsheet

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
7 2331
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
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
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
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
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
"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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

13
by: Allison Bailey | last post by:
Hi Folks, I'm a brand new Python programmer, so please point me in the right direction if this is not the best forum for this question.... I would like to open an existing MS Excel spreadsheet...
226
by: Stephen C. Waterbury | last post by:
This seems like it ought to work, according to the description of reduce(), but it doesn't. Is this a bug, or am I missing something? Python 2.3.2 (#1, Oct 20 2003, 01:04:35) on linux2 Type...
2
by: quadric | last post by:
Hi, I have an application that requires that Python initiate and mediate a live and iterative conversation between an external application (in which Python is embedded) and an external Excel...
6
by: Wolfgang Keller | last post by:
Hello, I'm looking for a spreadsheet application (MacOS X prefered, but Windows, Linux ar available as well) with support for Python scripting (third-party "plug-ins" are ok) and a database...
267
by: Xah Lee | last post by:
Python, Lambda, and Guido van Rossum Xah Lee, 2006-05-05 In this post, i'd like to deconstruct one of Guido's recent blog about lambda in Python. In Guido's blog written in 2006-02-10 at...
4
by: cmoller | last post by:
Hi, I am new to Python and the use of discussion groups. Is there a FAQ for basic information so certain questions are not repeated? I am NOT an experienced programmer, but have decided to...
162
by: Sh4wn | last post by:
Hi, first, python is one of my fav languages, and i'll definitely keep developing with it. But, there's 1 one thing what I -really- miss: data hiding. I know member vars are private when you...
0
by: Gary Herron | last post by:
Greg Lindstrom wrote: Here's a snippet of code I use to open a spreadsheet (given as a file path name), and compute and return the list of sheets it contains. It connects to an existing...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
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...
0
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,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.