2013-05-15 74 views

回答

2

你可以使用R1C1格式来做到这一点:

Row1 = 1 
Column1 = 2 
Row2 = 10 
Column = 2 

Formula = "=sum(r%(first)sc%(second)s:r%(third)sc%(fourth)s)" % {'first':Row1, 
                   'second':Column1, 
                   'third':Row2, 
                   'fourth':Column} 
xl.Cells(1,1).FormulaR1C1 = Formula 

使公式。在excel中使用R1C1格式化可以做很多精巧的事情,例如使用[]表示偏移量。使用Python编写公式不那么痛苦。希望这可以帮助!

+0

哇,我会尝试tomorov,如果这个工程它看起来很棒! –