1

Hi, I want to add data to excel sheet by clicking on Add Button. I am using tkinter for GUI and pandas to work with excel. I tried get() method to get data from entry field and add it to excel sheet. But I cant see anything in excel sheet. Please help. My code is as below.

===========

from tkinter import *
import pandas as pd

def UpdateSheet():
   writer = pd.ExcelWriter("Match1.xlsx")
   var.get(writer)
   writer.save()

top2=Tk()
top2.geometry("800x800")


var = StringVar()


t2name = Label(top2, text="Team 2 name").place(x=20, y=30)

t2entry = Entry(top2, width=30,textvariable=var).place(x=100, y=30)

sbtbtn2 = Button(top2, text="Submit", activebackground='Orange', activeforeground='Black', 
command=UpdateSheet).place(x=100, y=500)

top2.mainloop()
Nikhil
  • 11
  • 1

0 Answers0