Hi Javier,

I use xlwt (https://pypi.python.org/pypi/xlwt) to generate XLS spreadsheets. It is a fork of pyExcelerator which is not longer maintained.

For fairly standard spreadsheets it works well. You can do basic formatting, both in terms of fonts (bold etc), and also in terms of numeric formatting (currency and date formats etc).

Last I checked (and I don't think this has changed), it does not do charts or fancy stuff like that.

As long as it meets your needs it terms of spreadsheet complexity, it will work well. Runs on any platform (will be fine on a Linux web-server), and is fast.

I looked into this extensively a few years ago - at the time it was definitely the way to go as long as it meets your requirements in terms of capabilities.


Your other options are:

Under Linux etc.
Use a head-less copy of OpenOffice, and use its automation (pyUno) to generate a spreadsheet that way. Be prepared for a lot of pain. Use Jython (or bridge to java in some way) and use one of the Java libraries to generate XLS files. At least one of these has basic support for charts (although you may need a base template file to work from).

I know there are some .Net libraries that can also generate xlsx files - these may work under Mono and IronPython.


Under Windows:
All of the above, with the bonus that any .Net libraries are definitely going to work.
  Automate MS Office using Python's COM support.


The pro's of using automation (either OpenOffice or MS Office) is that you will get access to a much greater range of features. It will, however, be slow, and can take noticeable amounts of time to generate a large spreadsheet.

Any of the libraries that generate the file directly will be *much* faster, and a better fit for server-side deployment.



Hmm... just seen your last email regarding macros. Not sure if xlwt supports that. You may have luck with the xlutils library mentioned - otherwise you may need to move to one of the more heavy duty options - either using a Java or .Net / Mono library, or going for full automation (I'd suggest MS Office over OpenOffice if going that route).


Cheers,

Rasjid.






On 4/02/2014 2:29 PM, Javier Candeira wrote:
At work I need to manipulate a series of excel spreasheets, and I seem
to remember that people have discussed the topic in a meeting. I have
two questions to anyone who's already had to do the same:

- What's the current best Python library for excel manipulation?
- Are there any limitations for handling Excel sheets under Linux?
What kind of thing would I need Windows (and presumably, a live copy
of Office) for?

As background for the question, I'm trying to avoid using Windows at
all. My ideal workflow would involve users downloading generated
spreadsheets from a webserver.

Thanks,

Javier
_______________________________________________
melbourne-pug mailing list
melbourne-pug@python.org
https://mail.python.org/mailman/listinfo/melbourne-pug

_______________________________________________
melbourne-pug mailing list
melbourne-pug@python.org
https://mail.python.org/mailman/listinfo/melbourne-pug

Reply via email to