How can we get file name, sheet name, max rows, and max columns for all Excel files in a folder?

To iterate over the worksheets in a workbook, you should use for sheet in theFile.worksheets. Your current attempt is actually iterating over all of the rows in your workbook, starting at the active sheet.

sheet.max_col is also the incorrect function, use sheet.max_column

So your working code is now:

import openpyxl
import glob

inventory = []
path = '\\Users\\ryans\\OneDrive\\Desktop\\sample\\*.xlsx'
for f in glob.glob(path):
    # print(f)
    inventory.append(f)
    theFile = openpyxl.load_workbook(f)
    sheetnames = theFile.active

    for sheet in theFile.worksheets:
        # print(sheet)
        inventory.append(sheet)
        row_count = str(sheet.max_row)
        col_count = str(sheet.max_column)
        inventory.append(row_count)
        inventory.append(col_count)

print(inventory)