Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/excel/27.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 使用win32com.client统计Excel文件中的工作表数_Python_Excel_Win32com - Fatal编程技术网

Python 使用win32com.client统计Excel文件中的工作表数

Python 使用win32com.client统计Excel文件中的工作表数,python,excel,win32com,Python,Excel,Win32com,使用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 请张贴您尝试过的代码,

使用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

请张贴您尝试过的代码,并解释它如何不适合您。