简体   繁体   English

如何在Python中已存在的excel工作表中写入工作表?

[英]How do I write to one sheet in an already existing excel sheet in Python?

I got an excel file that has four sheets. 我有一个有四张纸的Excel文件。 One sheet, sheet 4. contains data in simple CSV and the others read the data of this sheet and make different calculations and graphs. 一张纸,一张纸4.包含简单CSV格式的数据,其他一张纸读取该数据,并进行不同的计算和绘制图形。 In my python application I would like to open the excel file, open sheet 4, and replace the data. 在我的python应用程序中,我想打开excel文件,打开工作表4,并替换数据。 I know you technically can't open and edit excel however you like with Python, due to the complex file structure of XLS ( previous relevant answer ), but is there a work around for this specific case? 我知道您在技术上无法打开和编辑excel,但是您喜欢使用Python,因为XLS的文件结构复杂( 先前的相关答案 ),但是在这种情况下是否可以解决? Remember the only thing I want to do is to open the data sheet, write to it, and ignore the others... 记住,我要做的唯一一件事就是打开数据表,写入数据表,然后忽略其他表...

Note: Previous answers to relevant questions have suggested using the copy function in xlutils. 注意:以前对相关问题的答案建议在xlutils中使用复制功能。 But that doesn't work in this case, as the rest of the sheets are rather complex. 但这在这种情况下不起作用,因为其余工作表相当复杂。 The graphs, for example, can't be preserved with the copy function. 例如,图形不能使用复制功能保存。

I used to use pyExcelerator. 我曾经使用pyExcelerator。 It did certainly a good job, but I'm not sure if it is maintained. 它当然做得很好,但我不确定是否可以维护。

https://pypi.python.org/pypi/pyExcelerator/ https://pypi.python.org/pypi/pyExcelerator/

hth. hth。

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

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