how to append data using openpyxl python to excel file from a specified row?

前端 未结 4 674
心在旅途
心在旅途 2020-12-28 23:32

I have different Python list variables(data1, data2, data3 ect) containing data which I want to put into an already existing excel sheet. Presently My loop goes like this.

4条回答
  •  攒了一身酷
    2020-12-29 00:09

    Try using

    sheet.max_row 
    

    it will return the last row value, You can start writing the new values from here.

    max = ws.max_row
    for row, entry in enumerate(data1,start=1):
       st.cell(row=row+max, column=1, value=entry)
    

    Hope it helps.Happy Coding :)

提交回复
热议问题