简体   繁体   English

跨平台的方式在Python中读取Excel文件?

[英]Cross platform way to read Excel files in Python?

I have some (Excel 2000) workbooks. 我有一些(Excel 2000)工作簿。 I want to extract the data in each worksheet to a separate file. 我想将每个工作表中的数据提取到一个单独的文件中。

I am running on Linux. 我在Linux上运行。

Is there a library I can use to access (read) XLS files on Linux from Python? 是否有一个库可以用来从Python访问(读取)Linux上的XLS文件?

Get xlrd from PyPI . 从PyPI获取xlrd Also go to the python-excel website to find out about (a) a tutorial (b) a discussion group (c) xlwt and xlutils . 还可以访问python-excel网站 ,了解(a)教程(b)讨论组(c) xlwtxlutils

[Dis]claimer: I'm the author & maintainer of xlrd , and maintainer of xlwt (which is a fork of pyExcelerator with bugs fixed and numerous enhancements). [Dis] claimer:我是xlrd的作者和维护者, xlrdxlwt (这是pyExcelerator的一个分支,修复了错误和许多增强功能)。

The easiest way would be to run excel up under Wine or as a VM and do it from Windows. 最简单的方法是在Wine下运行excel或作为VM运行并从Windows运行。 You can use Mark Hammond's COM bindings, which come bundled with ActiveState Python. 您可以使用Mark Hammond的COM绑定,它与ActiveState Python捆绑在一起。 Alternatively, you could export the data in CSV format and read it from that. 或者,您可以以CSV格式导出数据并从中读取数据。

我过去一直在使用pyexcelerator ,效果很好。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM