import win32com.client
import os
xlApp = win32com.client.Dispatch('Excel.Application')
xlApp.Visible = False
xls = xlApp.Workbooks.Open(os.getcwd() + "\\test.xls")
sheet = xls.Worksheets(1)
info = sheet.UsedRange
nrows = info.Rows.Count
ncols = info.Columns.Count
xls.Close(SaveChanges=0)
win32com python 查询excel行数列数
最新推荐文章于 2024-05-16 08:00:00 发布