python - Xlwings - Referencing saved range and appending additional values -


i pretty inexperienced programmer , have been trying practice basics in xlwings, python library works excel. working in 2.7.

i have made small program gui allows add entries down column in excel. noticed upon trying program overwrites saved values down column. lost in figuring out workable solution on how start list featuring range, , continuing append it.

from tkinter import * xlwings import workbook, range  root = tk() wb = workbook()  e1 = entry() e1.grid(row=1, column=2)  participant_list = []  """i realize starting empty list clear range every time run script, not sure correct solution should be."""  def pressed_button():      entry = e1.get()     e1.delete(0, end) # clear entry widget     temp = []     temp.append(entry)     participant_list.append(temp)     range('a1').value = participant_list     print participant_list # test  b1 = button(text="add participant", command=pressed_button) b1.grid(row=2, column=2)  mainloop() 

any in walking me through solution appreciated! i've tried few different things, embarrassed put them in demo code ha.

depending on want do, either read in data first , assign participant_list or find out last used cell in column: e.g. if there no empty rows, like

rng = range('a1').vertical.last_cell ... range((rng.row + 1, rng.column)).value = participant_list 

could work.


Comments

Popular posts from this blog

java - pagination of xlsx file to XSSFworkbook using apache POI -

Unlimited choices in BASH case statement -

apache - How do I stop my index.php being run twice for every user -