import pandas as pd
import tkinter as tk
from tkinter import *
from tkinter import filedialog
from pandas import ExcelWriter
from pandas import ExcelFile
def main():
df1= pd.read_excel (excel_filepath,"Sheet") ## here i am reading the file ##
df2= pd.read_excel (excel_filepath1,"Sheet2")
df= pd.read_excel (excel_filepath2,"Sheet1")
return
r=tk.Tk()
r.title('')
text1 = tk.Label(r, text="Enter File path of the INPUT AND EXP Excel file: ")
text1.grid(row = 1, column = 1)
excel_filepath = tk.StringVar()
df1= pd.read_excel (str(excel_filepath.get()),"Sheet")## this is the line showing error ##
heading1=list((df1.columns.values)) ## this is the line reading readings ##
CodePudding user response:
I created a Load button. When clicked, it will read the columns and will update the drop down:
def Load_excel_data():
enter code here`df1= pd.read_excel(excel_filename)
heading1=list((df1.columns.values))