Question

I am currently writing a script where I want to take the data and write it to a spreadsheet. I've found a few modules for writing xls files, however those only seem to work up to python 2.x, and I'm using 3.2 (also on a mac if that's helpful). Anyone have any ideas on how to get a python3.2 script to output to a spreadsheet?

Was it helpful?

Solution

Use the csv module. The intro from the docs:

The csv module implements classes to read and write tabular data in CSV format. It allows programmers to say, “write this data in the format preferred by Excel,” or “read data from this file which was generated by Excel,” without knowing the precise details of the CSV format used by Excel. Programmers can also describe the CSV formats understood by other applications or define their own special-purpose CSV formats.

OTHER TIPS

On Windows, you can use the COM interface: http://users.rcn.com/python/download/quoter.pyw

As @sdolan pointed out, CSV can be a good choice if your data is laid out in a tabular format.

Since Excel can save spreadsheets in an XML format, you can use XML tools to access the data.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top