4

使用 win32com.client,如何计算 excel 文件中的所有工作表数?

4

1 回答 1

7

找到了:

excel = win32.gencache.EnsureDispatch('Excel.Application')
try:
    wb = excel.Workbooks.Open(file)
except:
    print "Failed to open spreadsheet " + file
    sys.exit(1)
count = wb.Sheets.Count
于 2011-03-25T12:45:44.313 回答