简体   繁体   English

使用Python自动创建/处理Excel电子表格

[英]Using Python to Automate Creation/Manipulation of Excel Spreadsheets

I have some data in CSV format that I want to pull into an Excel spreadsheet and then create some standard set of graphs for. 我有一些CSV格式的数据,我想将它们提取到Excel电子表格中,然后为其创建一些标准的图形集。 Since the data is originally generated in a Python app, I was hoping to simply extend the app so that it could do all the post processing and I wouldn't have to do it by hand. 由于数据最初是在Python应用程序中生成的,因此我希望简单地扩展该应用程序,以便它可以执行所有后期处理,而无需手动进行。 Is there an easy interface with Python to work with and manipulate Excel spreadsheets? Python是否有一个易于使用和操作的Excel电子表格界面? Any good samples of doing this? 有什么好的例子吗? Is this Windows only (I'm primarily working on a Mac and have Excel, but could do this on Windows if necessary). 仅此Windows(我主要在Mac上工作并拥有Excel,但如有必要,可以在Windows上执行此操作)。

xlutils (以及随附的软件包xlrdxlwt )应允许您的Python程序方便地创建,读取和操作您可能想要的Excel文件!

On Windows you could use the pywin32 package to create an Excel COM Object and then manipulate it from a script. 在Windows上,您可以使用pywin32包创建一个Excel COM对象,然后从脚本中对其进行操作。 You need to have an installed Excel on that machine though. 不过,您需要在该计算机上安装Excel。 I haven't done this myself so I can't give you and details but I've seen this working so can at least confirm that it's possible. 我自己还没有完成此操作,因此无法提供详细信息,但我看到了此操作,因此至少可以确认这是可能的。 No idea about OS X, unfortunately. 不幸的是,没有关于OS X的想法。

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

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