Python - Xlwt more than 256 columns
发布时间: 2017-04-25 浏览次数: 520
标题:Python - Xlwt more than 256 columns
发表人:DiDi发表时间:2017-04-25
详细内容:Python - Xlwt more than 256 columns,怎么办,求解决

姓名:Panda

xlwt支持创建xls的文件,类似excel97-2003,这种格式的文件格式存在最多256列,65536行的限制,无法打破,除非他们再出新版本,给予支持

姓名:daDAN

你的数据超过了256列,用xlwt肯定不行,可以用openyxl来代替,或者改为存储为csv格式:

demo

from openpyxl import Workbook
wb = Workbook()
# grab the active worksheet
ws = wb.active
# Data can be assigned directly to cells
ws['A1'] = 42
# Rows can also be appended
ws.append([1, 2, 3])
# Python types will automatically be converted
import datetime
ws['A2'] = datetime.datetime.now()
# Save the file
wb.save('sample.xlsx')


我要发表跟帖

请登录发表跟帖