문제

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?

도움이 되었습니까?

해결책

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.

다른 팁

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.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top