Okay, to be honest I am quite stuck. My task is that I need to take 1 reference file some data from there (common columns among all files I mean) and then add that data to other files I selected (to that common columns), if the column name is the same with one which reference file has. The problem is that rows/columns are merged and I just can't reach some of them and get "Unnamed" for those columns anytime I run the code. Picture: https://i.sstatic.net/QsGrI4Kn.png. I attach the picture so it's easier to understand what I mean. The breakdown of the task; Select a reference Excel file and extract data from common columns that exist in other files. Check if the column names match between the reference file and the other files. Copy data from the reference file into the other files, if the columns are the same. Save modified files with the data. Will be very thankful if you give me any insights what I should do/fix. Thank you very much! Here is my code: import pandas as pd import tkinter as tk from tkinter import filedialog # Function to load the reference file and get column names def load_reference_file(): ref_file = filedialog.askopenfilename(title="Select Reference Excel File", filetypes=[("Excel Files", "*.xlsx")]) ref_df = pd.read_excel(ref_file) return ref_df, ref_df.columns.tolist() # Function to select fields from the reference file and update target files def update_files(reference_df, fields_to_update): # Select files to update target_files = filedialog.askopenfilenames(title="Select Target Excel Files", filetypes=[("Excel Files", "*.xlsx")]) for file in target_files: target_df = pd.read_excel(file) # For each field to update, check if the target file contains the field and update it for field in fields_to_update: if field in target_df.columns: target_df[field] = reference_df[field] # Update the field with the reference data # Save the updated file target_df.to_excel(file, index=False) print(f"Updated {file}") # GUI to select fields def select_fields(reference_df): def on_submit(): fields_to_update = [field for field in fields if field_var.get(field)] window.destroy() update_files(reference_df, fields_to_update) window = tk.Tk() window.title("Select Fields to Update") fields = reference_df.columns.tolist() field_var = tk.BooleanVar() for field in fields: tk.Checkbutton(window, text=field, variable=field_var, onvalue=field, offvalue=None).pack() tk.Button(window, text="Submit", command=on_submit).pack() window.mainloop() # Main program def main(): # Load the reference file reference_df, columns = load_reference_file() # Ask user to select which fields to update select_fields(reference_df) if __name__ == "__main__": main() [1]: https://i.sstatic.net/QsGrI4Kn.png Continue reading...