[已解决]ValueError: row index was 65536, not allowed by .xls format
报错:
ValueError: row index was 65536, not allowed by .xls format

解决方案:
xlrd和xlwt处理的是xls文件,单个sheet最大行数是65535,如果有更大需要的,建议使用openpyxl函数,最大行数达到1048576。
如果数据量超过65535就会遇到:ValueError: row index was 65536, not allowed by .xls format
import openpyxl
def readExel():
filename = r'D:\test.xlsx'
inwb = openpyxl.load_workbook(filename) # 读文件
sheetnames = inwb.get_sheet_names() # 获取读文件中所有的sheet,通过名字的方式
ws = inwb.get_sheet_by_name(sheetnames[0]) # 获取第一个sheet内容
# 获取sheet的最大行数和列数
rows = ws.max_row
cols = ws.max_column
for r in range(1,rows):
for c in range(1,cols):
print(ws.cell(r,c).value)
if r==10:
break
def writeExcel():
outwb = openpyxl.Workbook() # 打开一个将写的文件
outws = outwb.create_sheet(index=0) # 在将写的文件创建sheet
for row in range(1,70000):
for col in range(1,4):
outws.cell(row, col).value = row*2 # 写文件
print(row)
saveExcel = "D:\\test2.xlsx"
outwb.save(saveExcel) # 一定要记得保存
[已解决]ValueError: row index was 65536, not allowed by .xls format的更多相关文章
- ValueError: row index was 65536, not allowed by .xls format
报错:ValueError: row index was 65536, not allowed by .xls format 读取.xls文件正常,在写.xls文件,pd.to_excel()时候会报 ...
- loadrunner11破解失败,已解决“ license security violation.Operation is not allowed ”问题
参考链接https://blog.csdn.net/yongrong/article/details/7891738,亲测可以解决问题 在64位win7系统中安装LR11时,采用普通的方法无法授权.最 ...
- pandas里面过滤列出现ValueError: cannot index with vector containing NA / NaN values错误的解决方法(转)
###df_18的字段fuek是否包含 / df_18[df_18['fuel'].str.contains('/')] 报错: ValueError Traceback (most recent c ...
- 已解决】Sublime中运行带input或raw_input的Python代码出错:EOFError: EOF when reading a line(转)
[问题] 在折腾: [已解决]Sublime Text 2中运行Python程序出错:The system cannot find the file specified 的过程中,虽然解决了找不到py ...
- 【已解决】BeautifulSoup已经获得了Unicode的Soup但是print出来却是乱码
[问题] 某人遇到的问题: 关于BeautifulSoup抓取表格及SAE数据库导入的问题(跪求大神帮忙) 简单说就是: 用如下代码: ? 1 2 3 4 5 6 7 import re,urllib ...
- EasyUi中的datagird中a标签的click事件无法触发?(已解决)
***************************2015-10-29 21:07************************* 问题如下: datagrid最后一列编辑中有如下a标签 { f ...
- EasyUI datagrid 删除的时候无法正确找到重复记录row index的问题
EasyUI datagrid 删除的时候无法正确找到重复记录row index的问题: 如果无法正确找到重复记录的row index,就需要进行注意添加的时候所进行的 操作:如果添加的时候就是添加的 ...
- jquery easyui使用(三)······datagrid加载数据(已解决)
<div id="table_Data"> </div> $("#table_Data").datagrid({ toolbar: '# ...
- Microsoft.Office.Interop.Excel, Version=12.0.0.0版本高于引用的程序集(已解决)
Microsoft.Office.Interop.Excel, Version=12.0.0.0版本高于引用的程序集(已解决) 论坛里的帮助:http://bbs.csdn.net/topics/39 ...
随机推荐
- pytest进阶之fixture
前言 学pytest就不得不说fixture,fixture是pytest的精髓所在,就像unittest中的setup和teardown一样,如果不学fixture那么使用pytest和使用unit ...
- PHP错误:SQLSTATE[HY000] [2054] The server requested authentication method unknown to the client
使用PHP连接MySQL 8的时候,可能会发生如标题所示的错误: SQLSTATE[HY000] [2054] The server requested authentication method u ...
- Linux 桌面玩家指南:15. 深度学习可以这样玩
特别说明:要在我的随笔后写评论的小伙伴们请注意了,我的博客开启了 MathJax 数学公式支持,MathJax 使用$标记数学公式的开始和结束.如果某条评论中出现了两个$,MathJax 会将两个$之 ...
- Linux 使用 top 命令查看系统的运行情况
top命令显示界面 top命令默认在一个特定间隔(3秒)后刷新显示.要手动刷新,用户可以输入回车或者空格. top - 18:32:45 up 230 days, 2:01, 1 user, load ...
- [Swift]LeetCode1036.逃离大迷宫 | Escape a Large Maze
In a 1 million by 1 million grid, the coordinates of each grid square are (x, y) with 0 <= x, y & ...
- windows的80端口被占用时的处理方法
1.利用jfinal极速开发时,显示异常,80端口被占用. 2.win+R输入cmd打开黑窗口. netstat -ano | findstr 3.发现进程被占用,输入以下指令停止http服务 net ...
- 知识小罐头06(tomcat8请求源码分析 中)
更正上一篇一个小错误,Connector中首先是将socket请求过来的信息封装成一个普通的Request对象(上一篇我写成HttpRequest对象,失误失误,根本就木有HttpRequest这样的 ...
- .netcore 模块积累
最全的 demo https://github.com/XiaoFaye/netcore-samples http://files.cnblogs.com/files/kellynic/practic ...
- WebApiClient的接口输入验证
1. 文章目的 随着WebApiClient的不断完善,越来越多开发者选择WebApiClient替换原生的HttpClient,本文将介绍WebApiClient的接口参数输入有效性验证的新特性. ...
- Golang struct结构
结构struct Go中的struct与C中的struct非常相似,并且Go没有class,代替了class的位置,但并没有代替class的功能 使用type struct{} 定义结构,名称遵循可见 ...