ValueError: row index was 65536, not allowed by .xls format
#因为xlwt不支持大数据插入 所以用openpyxl 支持一百万的数据
下面展示一些 内联代码片。
输入文件名,sheet名称,Excel的标题list
和内容的list
再次写入数据只能替换原Excel的内容
def
WriteInExcel2(dest_filename,ws1sheetname,ws1title,ws1content):
wb = Workbook()
dest_filename = dest_filename
ws1 = wb.active
ws1.title = ws1sheetname
ws1['A4'] = '010174'
# 写单元格
ws1.cell(row=65536, column=1).value = '01017465536'
ws1.cell(row=995536, column=1, value='995536test')
ws1.column_dimensions['A'].width = 20.0
#设置列的列宽
# ws1.column_dimensions['B'].width = 20.0
# 写入标题
for col in range(len(ws1title)):
ws1.cell(row=1, column=col + 1).value = ws1title[col]
pass
for i in range(len(ws1content)):
for j in range(len(ws1content[i])):
ws1.cell(row=i + 2, column=j + 1).value = ws1content[i][j]
#print(ws1.column_dimensions)
wb.save(filename=dest_filename)
最后
以上就是高兴汽车最近收集整理的关于openpyxl写入百万级数据(替代xlwt row index was 65536, not allowed by)的全部内容,更多相关openpyxl写入百万级数据(替代xlwt内容请搜索靠谱客的其他文章。
本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
发表评论 取消回复