I am currently trying to average 3 excel columns(Col C to E) into and new 4th column (Col F). When I look up how to do this with openpyxl the code looks like this:
from openpyxl import load_workbook
wb = load_workbook('PythontestAvg.xlsx')
sheet1 = wb['full trace']
sheet2 = wb['full trace Copy']
sheet2["F1"] = '=AVERAGE(C1:E1)'
sheet2["F2"] = '=AVERAGE(C2:E2)'
However, doing this is very tedious for 1500 cells from F1 to F1501. Is there a way to write a code that will let me average each of the rows for the 3 columns and paste in Column F? Basically a code that will give the same result as:
sheet2["F1"] = '=AVERAGE(C1:E1)'
sheet2["F2"] = '=AVERAGE(C2:E2)'
sheet2["F3"] = '=AVERAGE(C3:E3)'
\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/
sheet2["F1501"] = '=AVERAGE(C1501:E1501)'
Please let me know if any more clarification is needed. Thanks in advance