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?
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)
Output is:
=SUM(B2:B25)
=SUM(B2:B25)
=SUM(B2:B25)
=SUM(B2:B25)
=SUM(B2:B25)