2013-07-30 26 views
0

我有一个Python程序,它的工作效果很好,但是......我需要在52个不同的工作表中总结所有同一个单元格的位置。使用python添加多个工作表中的同一个单元格

For example: I have 52 sheets and need to sum cell D75 across all the sheets in my coversheet. 

提个醒,让覆盖膜已经取得和我有没有问题,我只是需要确定如何将之变成我的盖板。

CHEERS !!!

+0

你没事带通过'xlwt'在Excel文件中的某个地方制作公式,然后通过'xlrd'读取它? – alecxe

回答

0

完全未经测试,让我知道,如果你不能得到这个工作,我会仔细看看

wb = open_workbook('simple.xls') 
values = [] 
for s in wb.sheets(): #iterate over the sheets 
    cell = sheet.cell(3,74) #D=3, need to offset 75 by 1 hence 74 
    values.append(float(cell.value)) 
print sum(values) 

还,这是一个相当好的教程http://www.simplistix.co.uk/presentations/python-excel.pdf

相关问题