I have a script that takes two excel files with two datasets and concatenates them and transforms various aspects of the resulting single data frame. I created this script in Jupyter Notebook. I want the person I am building this for to be able to utilize this script without having to interact with the Python. I am trying to figure out how to create a GUI that browses through one's files and allows you to bring in the two excel sheets, and then passes them to the script to be brought in as dataframes.
Currently I have some code copied from PySimpleGUI that allows me to browse and select two files. However I still am not sure how to pass the inputs from the GUI to my original script for transformation. Any advice would be greatly appreciated!
'''
Read in excel sheets
import PySimpleGUI as sg
GUI Code from PySimpleGUI
sg.theme('Light Blue 2')
layout = [[sg.Text('Enter 2 files to comare')],
[sg.Text('File 1', size=(8, 1)), sg.Input(), sg.FileBrowse()],
[sg.Text('File 2', size=(8, 1)), sg.Input(), sg.FileBrowse()],
[sg.Submit(), sg.Cancel()]]
print(layout[2])
window = sg.Window('File Compare', layout)
event, values = window.read()
window.close()
print(f'You clicked {event}')
print(layout[2])
Original Code
df1 = pd.read_excel("C:/Users/mcket747-es/Documents/highschoolData/Fall Spring 2019 Summer 2020 Number 3 .xls")
df2 = pd.read_excel("C:/Users/mcket747-es/Documents/highschoolData/Summer 2019 Number 3.xls")
Merge/Concatenate the dataframes & drop any duplicate roecords
df_merged = pd.concat([df1, df2])
df_merged.drop_duplicates(inplace=True)
'''