Python Program to combine data from Multiple Excel Worksheets

Ajay Anand
Ajay Anand
1.7 هزار بار بازدید - 12 ماه پیش - Python Program to combine data
Python Program to combine data from different Worksheets of an Excel Workbook is explained in this video. 1. Intro (https://www.seevid.ir/fa/w/cGfYtDwXMlo) 2. Download and Install Python (https://www.seevid.ir/fa/w/cGfYtDwXMlo) 3. Install pandas and tkinter (https://www.seevid.ir/fa/w/cGfYtDwXMlo) 3. Writing the code (https://www.seevid.ir/fa/w/cGfYtDwXMlo) 4. Explanation of the code (https://www.seevid.ir/fa/w/cGfYtDwXMlo) 5. Graphical User Interface for selecting the Excel file (https://www.seevid.ir/fa/w/cGfYtDwXMlo) 6. Demo of Excel Macro for combining data from multiple Worksheets (https://www.seevid.ir/fa/w/cGfYtDwXMlo) Check these Python Tutorials too. 📘 Python Program to Add Text and Insert Formulas in Multiple Excel Files. https://www.seevid.ir/fa/w/FOu7_5QqY0c 📘 Python Program to read multiple Excel Workbooks. https://www.seevid.ir/fa/w/M7YkQpcB4fg 📘 Combine data from different Worksheets of an Excel Workbook using Power Query https://www.seevid.ir/fa/w/z-QwyRdOGqQ Code import pandas as AJ from tkinter import * from tkinter import filedialog import os filepath = "" def openFile(): global filepath filepath = filedialog.askopenfilename() print(filepath) window.destroy() window = Tk() button = Button(text="Select Excel File", command=openFile) button.pack() window.mainloop() if filepath: AJxls = AJ.ExcelFile(filepath) AJdataframes = [] for sheet_name in AJxls.sheet_names: df = AJ.read_excel(filepath, sheet_name=sheet_name) AJdataframes.append(df) combined_data = AJ.concat(AJdataframes, ignore_index=True) directory_path = os.path.dirname(filepath) combined_file_path = os.path.join(directory_path, 'Data_Combined_GUI.xlsx') combined_data.to_excel(combined_file_path, index=False) print("Data from all Sheets combined and saved to", combined_file_path) else: print("No file selected") #pythontutorial #pythonforexcel #pythontutorialforbeginners
12 ماه پیش در تاریخ 1402/07/02 منتشر شده است.
1,731 بـار بازدید شده
... بیشتر