加载中…
个人资料
  • 博客等级:
  • 博客积分:
  • 博客访问:
  • 关注人气:
  • 获赠金笔:0支
  • 赠出金笔:0支
  • 荣誉徽章:
正文 字体大小:

Python获取Excel表有数据的所有行数和列数

(2021-02-18 20:47:20)
used_range
Used Range of Sheet.
 
Returns:
Return type: xw.Range
last_cell
Returns the bottom right cell of the specified range. Read-only.
 
Returns:
Return type: Range
 

import xlwings as xw
 
wb = xw.Book(r'F:\xlwings\OriginalData.xlsx')
 
sht = wb.sheets[0]
 
info = sht.used_range
 
nrows = info.last_cell.row
print(nrows)
 
ncolumns = info.last_cell.column
print(ncolumns)

参见:https://blog.csdn.net/qq_31989047/article/details/103318044

0

阅读 收藏 喜欢 打印举报/Report
  

新浪BLOG意见反馈留言板 欢迎批评指正

新浪简介 | About Sina | 广告服务 | 联系我们 | 招聘信息 | 网站律师 | SINA English | 产品答疑

新浪公司 版权所有