473,738 Members | 7,599 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Excel module for Python

sam
Hi group,

I m wondering which Excel module is good to be used by Python?

Thanks
Sam
Jul 18 '05 #1
10 5887
sam wrote:
I m wondering which Excel module is good to be used by Python?


Just use Excel's COM interface.

See also this helpful page to improve future responses:
http://www.catb.org/~esr/faqs/smart-questions.html

-Peter
Jul 18 '05 #2
On Wed, 12 Jan 2005 15:18:09 +0800, sam <sa*****@authte c.com> wrote:
I m wondering which Excel module is good to be used by Python?


If you are on Windows, and you have Excel, then the Python for Windows
extensions[1] are all you need to drive Excel via COM. O'Reilly's
"Python Programming on Win32" covers COM scripting extensively - and
by good fortune, driving Excel is the example they use, and the COM
scripting chapter is on-line[2].

You'll also need to know the objects and methods that Excel exposes.
These are documented on Microsoft's web site[3], or in the Excel VBA
help, which is an optional part of they Office installation.

--
Cheers,
Simon B,
si***@brunningo nline.net,
http://www.brunningonline.net/simon/blog/

[1] http://starship.python.net/crew/mhammond/
[2] http://www.oreilly.com/catalog/pytho...pter/ch12.html
[3] http://msdn.microsoft.com/library/en...celObjects.asp
Jul 18 '05 #3
sam
Simon Brunning wrote:
On Wed, 12 Jan 2005 15:18:09 +0800, sam <sa*****@authte c.com> wrote:
I m wondering which Excel module is good to be used by Python?

If you are on Windows, and you have Excel, then the Python for Windows
extensions[1] are all you need to drive Excel via COM. O'Reilly's
"Python Programming on Win32" covers COM scripting extensively - and
by good fortune, driving Excel is the example they use, and the COM
scripting chapter is on-line[2].

You'll also need to know the objects and methods that Excel exposes.
These are documented on Microsoft's web site[3], or in the Excel VBA
help, which is an optional part of they Office installation.


No, I don't use MS windows. I need to generate Excel file by printing
data to it, just like Perl module Spreadsheet::Wr iteExcel.

thanks
Sam
Jul 18 '05 #4
that's easy. Just make an html file of your data, using tables and save
it as a "*.xls" and excel will think it's an excel file.

Jul 18 '05 #5
sam wrote:
On Wed, 12 Jan 2005 15:18:09 +0800, sam <sa*****@authte c.com> wrote:
I m wondering which Excel module is good to be used by Python?
[snip] No, I don't use MS windows. I need to generate Excel file by printing
data to it, just like Perl module Spreadsheet::Wr iteExcel.


Excel can read CSV files, so just use the standard Python module "csv"
and write your files that way.

-Peter
Jul 18 '05 #6
On Wed, 12 Jan 2005 23:19:44 +0800, sam <sa*****@authte c.com> wrote:

No, I don't use MS windows. I need to generate Excel file by printing
data to it, just like Perl module Spreadsheet::Wr iteExcel.


If it's just data that needs to go into your spreadsheet, then I'd
just build a CSV file if I were you. Excel opens them perfectly
happily.

If you need to write out formulae, formratting, that kind of thing,
then I think you'll need to write a 'real' Excel file. I don't have a
clue how to do that - sorry.

--
Cheers,
Simon B,
si***@brunningo nline.net,
http://www.brunningonline.net/simon/blog/
Jul 18 '05 #7
sam wrote:
Simon Brunning wrote:
On Wed, 12 Jan 2005 15:18:09 +0800, sam <sa*****@authte c.com> wrote:
I m wondering which Excel module is good to be used by Python?


If you are on Windows, and you have Excel, then the Python for Windows
extensions[1] are all you need to drive Excel via COM. O'Reilly's
"Python Programming on Win32" covers COM scripting extensively - and
by good fortune, driving Excel is the example they use, and the COM
scripting chapter is on-line[2].

You'll also need to know the objects and methods that Excel exposes.
These are documented on Microsoft's web site[3], or in the Excel VBA
help, which is an optional part of they Office installation.


No, I don't use MS windows. I need to generate Excel file by printing
data to it, just like Perl module Spreadsheet::Wr iteExcel.

thanks
Sam


Hello,

If you can use jython then there is something that does this
in java - it's called POI (search for POI HSSF Excel) in google. If you
can't use jython and are desperate then you could set up a
WebService/cgi/<insert your favourite cross language client/server
architecture> and send the information back and forth. I spose you can
do this with perl as well (don't know any perl so this bit is only a
guess!).

However the last time I looked (about a year ago) POI does have
limitations with excel graphs.

Cheers,

Neil

Jul 18 '05 #8
Simon Brunning <si************ @gmail.com> writes:
On Wed, 12 Jan 2005 23:19:44 +0800, sam <sa*****@authte c.com> wrote:

No, I don't use MS windows. I need to generate Excel file by printing
data to it, just like Perl module Spreadsheet::Wr iteExcel.
If you need to write out formulae, formratting, that kind of thing,
then I think you'll need to write a 'real' Excel file. I don't have a
clue how to do that - sorry.


There's actually an ancient open spreadsheet format called SYLK which
is a step above CSV: it allows formatting of data, formulas etc.

Google for SYLK to get the rather sparse specification (and skip over
the first few links!)

If you want to generate "real" Office files from UNIX, another
alternative is to automate OpenOffice (which has a COM-like interface
too) or generate OO XML files and feed them to OO asking to conver
them with a bit of OO macro magic.

--
=============== =============== =============== =============== ===
<er**********@a ndreasen.org> Herlev, Denmark
<URL:http://www.andreasen.o rg/> <*>
=============== =============== =============== =============== ===

Jul 18 '05 #9
Hi,

I didn't catch older mails in this thread, so excuse me if this has
already been pointed out:

http://pyxlwriter.sourceforge.net/

"It's a port of John McNamara's Perl Spreadsheet::Wr iteExcel module"
and it's really easy to use.
I'm not sure if it does formulae, but it handles formatting fine.

Putting together a file with complicated layout can be a lot of work,
so for large prebuilt files (which I sometimes have to "fill in"
programmaticall y), I just use COM with Excel. You'll have to run on
Windows for that, of course. ;-)

Cheers
Stefan

On 16.01.2005, at 22:19, Erwin S. Andreasen wrote:
Simon Brunning <si************ @gmail.com> writes:
On Wed, 12 Jan 2005 23:19:44 +0800, sam <sa*****@authte c.com> wrote:

No, I don't use MS windows. I need to generate Excel file by printing
data to it, just like Perl module Spreadsheet::Wr iteExcel.

If you need to write out formulae, formratting, that kind of thing,
then I think you'll need to write a 'real' Excel file. I don't have a
clue how to do that - sorry.


There's actually an ancient open spreadsheet format called SYLK which
is a step above CSV: it allows formatting of data, formulas etc.

Google for SYLK to get the rather sparse specification (and skip over
the first few links!)

If you want to generate "real" Office files from UNIX, another
alternative is to automate OpenOffice (which has a COM-like interface
too) or generate OO XML files and feed them to OO asking to conver
them with a bit of OO macro magic.


Jul 18 '05 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
2484
by: ÒÊÃÉɽÈË | last post by:
i want to compare the content in excel,but i don't know whick module to use! can you help me?
3
3531
by: Mark | last post by:
Not sure if this is the proper forum, but we'll give it a try. I want my VB.Net program to open an Excel workbook and then execute a VB procedure residing in the Excel workbook. I'd like to get sample code to try this out. Thanks, Mark
6
6674
by: AleydisGP | last post by:
I have a .plt file (which is a tab delimited ASCII file) and I want to format it to get a .dbf with data in rows and columns, detele some rows/columns and substitute decimal '.' with ','. All this using Python (I'm using Pythonwin). The .plt file looks like this: * ISCST3 (02035): Tersa * MODELING OPTIONS USED: * CONC URBAN ELEV DFAULT
0
2755
by: liam_jones | last post by:
I'm very new to Python, well IronPython to precise, and have been having problems when using Excel. The problem I'm having is the closing of my Excel object. I'm able to successfully quit the Excel Application that I create, but when I open a Workbook in the Application I can't successfully Quit Excel (by this I mean I can quit it, but the Excel process isn't getting killed and I have to manually go this through Task Manager). I've...
1
4812
by: Girish | last post by:
Hi, I want to embed a txt document into an excel using python. Here is my code, but i get an error message =================================================== Traceback (most recent call last): File "C:\Documents and Settings\kusumap\Desktop\Girish.py", line 7, in ? worksheet.OLEObjects.Add(Filename="C:\Documents and Settings
2
14728
by: jld730 | last post by:
Hello All, I wrote Python code to write data to an Excel worksheet1, and also add 5 status types to worksheet2 to be used to make a dropdown list for one column in worksheet1. Could someone help me with the code to do this in Python? I recorded the macro >> Sub Macro2() ' ' Macro2 Macro '
1
1102
Elias Alhanatis
by: Elias Alhanatis | last post by:
Hello to everybody! I have created an app which calculates some statistical data. I use the following function to get Excel to print a page with the data. def Create_Analysis_Page(Name,Job,Phone,Month,Analysing_Dict,preview=False): xlApp = Dispatch ("Excel.Application") xlWb = xlApp.Workbooks.Open ("C:\\Python25\\Misthos.xlsx")
9
16151
by: Larry Hale | last post by:
I've heard tell of a Python binding for libmagic (file(1) *nixy command; see http://darwinsys.com/file/). Generally, has anybody built this and worked with it under Windows? The only thing I've been able to find is the python-magic module at http://hupp.org/adam/hg/python-magic/. Is this "THE" python-magic module. (It seems to be to me, but obviously I don't know. :)
2
2423
by: dubana09 | last post by:
Hi all, I’m relatively new to python. I’m using a process simulation package which is stuck in the past unfortunately – it would not support any version older than python 2.2. This fairly frustrating as you can imagine. This means I cannot use pyExcelerator or xlwt to create spreadsheets and write to excel. Unlike reading (using xlrd), there doesn’t seem to be any package library out there for writing that is supported in python 2.2. I’m...
0
8969
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9476
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
9263
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9208
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6751
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6053
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4825
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
2745
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2193
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.