Python Program to combine data from Multiple Excel Worksheets
Автор: Ajay Anand
Загружено: 2023-09-24
Просмотров: 2422
Описание:
Python Program to combine data from different Worksheets of an Excel Workbook is explained in this video.
1. Intro (0:00)
2. Download and Install Python (0:56)
3. Install pandas and tkinter (1:40)
3. Writing the code (2:09)
4. Explanation of the code (7:44)
5. Graphical User Interface for selecting the Excel file (9:28)
6. Demo of Excel Macro for combining data from multiple Worksheets (12:52)
Check these Python Tutorials too.
📘 Python Program to Add Text and Insert Formulas in Multiple Excel Files.
• Python Program edit 1000s of Excel Files
📘 Python Program to read multiple Excel Workbooks.
• Python Program to extract data from multip...
📘 Combine data from different Worksheets of an Excel Workbook using Power Query
• Combine data from multiple sheets of an Ex...
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")
🍐 Top 25 Microsoft Word Tips and Tricks - • Top 25 Microsoft Word Tips and Tricks
🍓 7 Most Important Tools in Excel - • Most important Tools in Excel
🍏Download my free eBook on Excel Macros - http://eepurl.com/gpT0RD
🍇Check these Books on Excel - https://xlncad.com/excel-resources/
🍉Read my articles on Excel - https://xlncad.com/
☕ If you’ve found my videos helpful or enjoyable, consider supporting me with a coffee!
👉 buymeacoffee.com/ajayanand
Subscribe to @XLnCADMalayalam for Excel, Word, PowerPoint, Access, Python and Power BI Tutorials in Malayalam.
/ xlncadmalayalam
📢 Disclaimer: If you click on my affiliates links, I am going to receive a tiny commission. The products that I advertise are the ones I believe in.
🏃♂️ My Running Kit for Hyderabad Marathon 2025
https://amzn.to/44IILeG
📊 Think Like an Analyst: Books That Helped Me
https://amzn.to/3SNy6bi
📚 Mind-Opening Reads You Can’t Miss
https://amzn.to/43tM2fu
#pythontutorial #pythonforexcel #pythontutorialforbeginners
Повторяем попытку...

Доступные форматы для скачивания:
Скачать видео
-
Информация по загрузке: