用于处理Excel文件的Python库(xls | xlsx)

时间:2023-01-15 11:32:26

I need a python library that could read and write Excel files with all formats (i.e xls and xlsx).

我需要一个python库,可以读取和写入所有格式的Excel文件(即xls和xlsx)。

I'm new to python and I was using Java before. In Java I was using POI library and it was perfect. I need a python library with the same functionality if possible.

我是python的新手,之前我正在使用Java。在Java中,我使用的是POI库,它非常完美。如果可能的话,我需要一个具有相同功能的python库。

2 个解决方案

#1


4  

I know this thread hasn't been active in a while, but I thought it would be nice to add an answer here since I made a new solution to this problem.

我知道这个帖子在一段时间内没有活动,但我认为在这里添加答案会很好,因为我对这个问题做了一个新的解决方案。

I had this same issue so I went ahead and created a small library that includes python-excel (xlrd, xlwt) and openpyxl within it. You can find it here: https://github.com/camyoung1234/spreadsheet

我有同样的问题所以我继续创建了一个包含python-excel(xlrd,xlwt)和openpyxl的小型库。你可以在这里找到它:https://github.com/camyoung1234/spreadsheet

Then to use it you type the exact same code as openpyxl, except you replace openpyxl with spreadsheet. When you load and save files it looks at the extension and determines which library to use for handling it.

然后使用它键入与openpyxl完全相同的代码,除了用电子表格替换openpyxl。加载和保存文件时,它会查看扩展名并确定用于处理它的库。

To install it just download it, extract it, rename the folder spreadsheet-master to spreadsheet and place it in PythonXX/Lib/site-packages/ (I've only tested with Python 2.7 but it should work with others)

要安装它,只需下载它,解压缩,将文件夹电子表格主文件重命名为电子表格并将其放在PythonXX / Lib / site-packages /中(我只用Python 2.7测试但它应该与其他人一起使用)

The README has a few examples to help you get started.

README有几个例子可以帮助您入门。

#2


1  

Python excel looks like a go: http://www.python-excel.org/

Python excel看起来很像:http://www.python-excel.org/

Also OpenPyXl may have the features you need: http://packages.python.org/openpyxl/

OpenPyXl也可能具备您需要的功能:http://packages.python.org/openpyxl/

#1


4  

I know this thread hasn't been active in a while, but I thought it would be nice to add an answer here since I made a new solution to this problem.

我知道这个帖子在一段时间内没有活动,但我认为在这里添加答案会很好,因为我对这个问题做了一个新的解决方案。

I had this same issue so I went ahead and created a small library that includes python-excel (xlrd, xlwt) and openpyxl within it. You can find it here: https://github.com/camyoung1234/spreadsheet

我有同样的问题所以我继续创建了一个包含python-excel(xlrd,xlwt)和openpyxl的小型库。你可以在这里找到它:https://github.com/camyoung1234/spreadsheet

Then to use it you type the exact same code as openpyxl, except you replace openpyxl with spreadsheet. When you load and save files it looks at the extension and determines which library to use for handling it.

然后使用它键入与openpyxl完全相同的代码,除了用电子表格替换openpyxl。加载和保存文件时,它会查看扩展名并确定用于处理它的库。

To install it just download it, extract it, rename the folder spreadsheet-master to spreadsheet and place it in PythonXX/Lib/site-packages/ (I've only tested with Python 2.7 but it should work with others)

要安装它,只需下载它,解压缩,将文件夹电子表格主文件重命名为电子表格并将其放在PythonXX / Lib / site-packages /中(我只用Python 2.7测试但它应该与其他人一起使用)

The README has a few examples to help you get started.

README有几个例子可以帮助您入门。

#2


1  

Python excel looks like a go: http://www.python-excel.org/

Python excel看起来很像:http://www.python-excel.org/

Also OpenPyXl may have the features you need: http://packages.python.org/openpyxl/

OpenPyXl也可能具备您需要的功能:http://packages.python.org/openpyxl/