enter image description hereI would like to perform a calculation with XLWT I'm new to coding and bit confused with using for loop to repeat the formula in following columns, please help me understanding the for loop function for the below calculation
Please refer the image, I need a for loop to fill rest of the columns, so that I do not have to type 'w_sheet.write(1,2,xlwt.Formula('A2-B2'))' multiple times
import xlrd
import xlwt
from xlutils.copy import copy
wb = xlrd.open_workbook('Subtract.xls')
rb = copy(rb)
w_sheet = wb.get_sheet(0)
w_sheet.write(1,2,xlwt.Formula('A2-B2'))
w_sheet.write(2,2,xlwt.Formula('A3-B3'))
w_sheet.write(3,2,xlwt.Formula('A4-B4'))
w_sheet.write(4,2,xlwt.Formula('A4-B4'))
wb.save('Subtract.xls')