Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
使用 win32com.client,如何计算 excel 文件中的所有工作表数?
找到了:
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