关于溢出的第一个问题,我来问。在
在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}$
因为我不知道该放什么来数一数。
提前谢谢你的帮助。在