473,396 Members | 1,849 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,396 software developers and data experts.

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 5850
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*****@authtec.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***@brunningonline.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*****@authtec.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::WriteExcel.

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*****@authtec.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::WriteExcel.


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*****@authtec.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::WriteExcel.


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***@brunningonline.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*****@authtec.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::WriteExcel.

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*****@authtec.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::WriteExcel.
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**********@andreasen.org> Herlev, Denmark
<URL:http://www.andreasen.org/> <*>
================================================== =============

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::WriteExcel 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"
programmatically), 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*****@authtec.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::WriteExcel.

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
I generate a lot pseudo excel file. Just write row by row on file and
separate every cell of a row by a tab and put an .xls extension on the
file name. When you double click. It opens directly EXCEL and you have
directly the column and the row. It is easier than the CSV or SYLK
files. If you want to format it automatically you can either define a
VBA macro or use python com.

Cheers,

Jean-Paul

Jul 18 '05 #11

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

Similar topics

6
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
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...
6
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...
0
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...
1
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...
2
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...
1
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...
9
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...
2
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...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
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
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...
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...

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.