Append Data from TkInter to Excel - Printable Version +- Python Forum (https://python-forum.io) +-- Forum: Python Coding (https://python-forum.io/forum-7.html) +--- Forum: GUI (https://python-forum.io/forum-10.html) +--- Thread: Append Data from TkInter to Excel (/thread-1904.html) |
Append Data from TkInter to Excel - zinho - Feb-03-2017 Hi, I'm new in python. I stole this code here and i need adat it. How save data in existing excel file (below last data) I need a function to save into excel. from tkinter import * class GUI: def __init__(self, master): self.master = master master.title("Torneio de Sinuca...") self.var = IntVar() self.label = Label(master, textvariable=self.var) self.label.pack() self.listbox = Listbox(master) self.listbox.pack() self.var.set(self.listbox.size()) self.element = StringVar() self.Entry = Entry(master, textvariable=self.element) self.Entry.pack() self.close_button = Button(master, text="Adicionar", command=self.test) self.close_button.pack() def test(self): if len(self.element.get()) != 0: value1 = (self.element.get()) self.listbox.insert(END, value1) #shows how many items in list #print (self.listbox.size()) self.var.set(self.listbox.size()) self.Entry.delete(0, END) def howSaveExistingExcelFile(): # I need save data (name inside listbox) into excel, below last data root = Tk() my_gui = GUI(root) root.geometry("230x250") root.mainloop()I find it from xlrd import open_workbook from xlwt import Workbook from xlutils.copy import copy rb = open_workbook("Login.xls") wb = copy(rb) s = wb.get_sheet(0) s.write(0,0,'A1') #This code save ever on first cell, I need save below last row wb.save('Login.xls')Thank you!! RE: Append Data from TkInter to Excel - zinho - Feb-15-2017 Hi. Someone understand my post? I can try explaning again... RE: Append Data from TkInter to Excel - johnathon - Feb-15-2017 (Feb-03-2017, 01:15 PM)zinho Wrote: Hi, I'm new in python. Okay so let me get this right... You want to get input from a GUI and store it into a excel file / csv file? RE: Append Data from TkInter to Excel - zinho - Feb-15-2017 Hi johnathon , yes, i need get data into GUI and store it into a excel file, but ever below old data inside excel file. RE: Append Data from TkInter to Excel - Larz60+ - Feb-15-2017 You should post this thread under jobs. This forum is to help with programming. We expect you to make an effort, and to ask questions when you need help. We will write code, sometimes, if a spec is listed under jobs, and compensation is offered. If you want to give it a try, you can start here: https://pymotw.com/3/csv/ RE: Append Data from TkInter to Excel - johnathon - Feb-16-2017 (Feb-15-2017, 06:23 PM)zinho Wrote: Hi johnathon , yes, i need get data into GUI and store it into a excel file, but ever below old data inside excel file. I won't write the code for you as documentation for this module is openly available and easy to understand... But use the csv module. It is a very easy to understand module. When writing to the CSV file use "append / a" so it doesn't overwrite previously existing data. |