I am using the openpyxl method to write values in Python to Excel. I have around 30 integer values in python which I want to dynamically write to specific Excel cells.
For example, value1-value5 should be written to B1-B5, when this is complete, we should move to the next column and write value6-value10 in cells C1-C5.
I am using the below code, but need help making it dynamic
#create workbook object
wb=openpyxl.load_workbook("report.xlsx")
type (wb)
#get sheet names
wb.get_sheet_names()
#create reference for sheet on which to write
worksheet= wb.get_sheet_by_name("Sheet1")
#use sheet reference and write the cell address
**worksheet["B1"]=value1** #this part needs to be automated
#save workbook
wb.save("report.xlsx")