'What's the fastest way to go down a directory and read in multiple excel workbooks with multiple tabs?

I would like to go into a directory and retrieve every excel workbook that meets the criteria in my if statement (if the extension is ".xlsb" and the letters "USA" are in the name). The excel workbooks have multiple tabs and I need to be able to view the contents of them. My code works fine, but it's painfully slow. Is there a faster method of doing this? I believe the pd.read_excel is what's taking the longest time.

I thought maybe converting the files to a pickle would speed it up, but I don't know how to do that without first reading in the file as a dataframe.

My code returns a list of workbooks in dictionary format (Sheet name: Sheet contents)

Any help would be appreciated. Thanks!

rootdir = "SOME PATH"
wbs = [] #instantiate workbook list
for subdir, dirs, files in os.walk(rootdir, topdown = False):
    for file in files:
        if file.endswith(".xlsb") and "USA" in file.lower(): # if the file name has USA in it
            temp_list = [] # create a list of sheets
            wb_dict = pd.read_excel(os.path.join(subdir, file), sheet_name = None) #create the dfs
            temp_list.append(wb_dict)           
    wbs = wbs + temp_list
    temp_list = []


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source