My starter scripts in January 2021:
Combine multiple Excel files from a folder
I always advocate finding a problem early on when picking up a new programming language. It works for me, giving my learning structure and pulling me towards a goal.
With Python, I started with cheatsheets for basic familiarity and then picked up the O’Reilly Cookbook, always with the aim in mind - that I would start my Python journey writing scripts that solve problems I see in Excel.
The first problem is managing multiple Excel files - sometimes separate files are best (faster/share-able), other times I want all the data in a single Excel Sheet, for analysis; today I’m showing the latter.
So here’s a snippet that loops through each Excel file in a folder (including subfolders), collects the data in the first sheet, and adds a new column for reference back to the filename. The aggregated data is then output to a new Excel Workbook.
Any thoughts or questions, get in touch
Have a look at the code I used, here: