| 作者: | Eric Gazoni, Charlie Clark |
|---|---|
| 源代码: | https://foss.heptapod.net/openpyxl/openpyxl |
| 问题: | https://foss.heptapod.net/openpyxl/openpyxl/-/issues |
| 生成: | 2021 年 3 月 9 日 |
| 许可: | MIT/Expat |
| 版本: | 3.0.7 |
openpyxl 是读/写 Excel 2010 xlsx/xlsm/xltx/xltm 文件的 Python 库。
它诞生于缺乏从 Python 读/写本地 Office Open XML 格式的现有库。
所有荣誉归 PHPExcel 团队,因为 openpyxl 最初基于 PHPExcel。
默认情况下,openpyxl 不防范 2 次方爆炸或 billion laughs xml 攻击。要防范这些攻击,请安装 defusedxml。
可以找到用户列表在 http://groups.google.com/group/openpyxl-users
样本代码:
from openpyxl import Workbook wb = Workbook() # grab the active worksheet ws = wb.active # Data can be assigned directly to cells ws['A1'] = 42 # Rows can also be appended ws.append([1, 2, 3]) # Python types will automatically be converted import datetime ws['A2'] = datetime.datetime.now() # Save the file wb.save("sample.xlsx")
文档编制在: https://openpyxl.readthedocs.io
发行说明: https://openpyxl.readthedocs.io/en/stable/changes.html
This is an open source project, maintained by volunteers in their spare time. This may well mean that particular features or functions that you would like are missing. But things don’t have to stay that way. You can contribute the project 开发 yourself or contract a developer for particular features.
Professional support for openpyxl is available from Clark Consulting & Research and Adimian . Donations to the project to support further development and maintenance are welcome.
Bug reports and feature requests should be submitted using the issue tracker . Please provide a full traceback of any error you see and if possible a sample file. If for reasons of confidentiality you are unable to make a file publicly available then contact of one the developers.
The repository is being provided by Octobus and Clever Cloud .
Any help will be greatly appreciated, just follow those steps:
1. Please join the group and create a branch ( https://foss.heptapod.net/openpyxl/openpyxl/ ) and follow the Merge Request Start Guide . for each independent feature, don’t try to fix all problems at the same time, it’s easier for those who will review and merge your changes ;-)
2. Hack hack hack
3. Don’t forget to add unit tests for your changes! (YES, even if it’s a one-liner, changes without tests will not be accepted.) There are plenty of examples in the source if you lack know-how or inspiration.
4. If you added a whole new feature, or just improved something, you can be proud of it, so add yourself to the AUTHORS file :-)
5. Let people know about the shiny thing you just implemented, update the docs!
6. When it’s done, just issue a pull request (click on the large “pull request” button on your repository) and wait for your code to be reviewed, and, if you followed all theses steps, merged into the main repository.
进一步信息见 开发
There are several ways to contribute, even if you can’t code (or can’t code well):
Install openpyxl using pip. It is advisable to do this in a Python virtualenv without system packages:
$ pip install openpyxl
注意
There is support for the popular lxml library which will be used if it is installed. This is particular useful when creating large files.
警告
To be able to include images (jpeg, png, bmp,…) into an openpyxl file, you will also need the “pillow” library that can be installed with:
$ pip install pillow
or browse https://pypi.python.org/pypi/Pillow/ , pick the latest version and head to the bottom of the page for Windows binaries.
Sometimes you might want to work with the checkout of a particular version. This may be the case if bugs have been fixed but a release has not yet been made.
$ pip install -e hg+https://foss.heptapod.net/openpyxl/openpyxl/@3.0#egg=openpyxl