In this article, we will see how to read all Excel files in a folder into single Pandas dataframe. The task can be performed by first finding all excel files in a particular folder using glob() method and then reading the file by using pandas.read_excel() method and then displaying the content.
- Import necessary python packages like pandas, glob, and os.
- Use glob python package to retrieve files/pathnames matching a specified pattern i.e. ‘.xlsx’
- Loop over the list of excel files, read that file using pandas.read_excel().
- Convert each excel file into a dataframe.
- Display its location, name, and content.
Below is the implementation.
Note: The program reads all Excel files in the folder in which the program itself is present.
Attention geek! Strengthen your foundations with the Python Programming Foundation Course and learn the basics.
To begin with, your interview preparations Enhance your Data Structures concepts with the Python DS Course. And to begin with your Machine Learning Journey, join the Machine Learning – Basic Level Course