python如何统计行数_统计选项卡中的行数

关于溢出的第一个问题,我来问。在

在openpyxl中使用python3.7

我有几张大的excel表格,每个表格都有几张。

我使用for循环遍历每个表和表,并希望获取每个表的行数。在

我用google-fu浏览了一下,但是没有用。在

以下是我目前所掌握的情况:#Import excel reader/writer

from openpyxl import load_workbook

import os

#Open the execl spreadsheet

try:

wb = load_workbook(os.path.expanduser( "~/Documents/EST Attendance.xlsx"))

except:

print("File not found, ensure the file is placed under Documents and named 'EST Attendance'")

#Loop through all the sheets in workbook

for sheet in wb:

#Print the current worksheet

print(str(sheet))

#Loop through all the tables in the workbook, print "Name" : "Rows"

for table in sheet._tables:

print(" " + str(table.name) + " : " + str(table.nrows))

print("Loop successful")

脚本在以下时间崩溃:

^{pr2}$

因为我不知道该放什么来数一数。

提前谢谢你的帮助。在

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值