Print sum value of a range with Python
<p>I am trying to print the value in the cell B26. So far all my print out is '=SUM(B2:B25)' for each iteration. How can I print the sum value in the range of B2:B25?</p>

<pre><code>import glob
import openpyxl

path = 'C:/ExcelFolder/*.xlsx'
files = glob.glob(path)
for file in files:
  wb = openpyxl.load_workbook(file)
  sheet2 = wb.get_sheet_by_name('TOTAL')
  Totals = sheet2.cell(row=26, column=2).value
  print(Totals)
</code></pre>

<p>Output is:</p>

<pre><code>=SUM(B2:B25)
=SUM(B2:B25)
=SUM(B2:B25)
=SUM(B2:B25)
=SUM(B2:B25)
</code></pre>