用python 保存excel文件时出错如何 解决 30
创建一个excel一个sheet在里面写了点东西然后保存时出错大神来救我用的python3.2模块是xlwt3...
创建一个excel 一个sheet 在里面写了点东西然后保存时出错 大神来救
我用的python3.2 模块是xlwt3 展开
我用的python3.2 模块是xlwt3 展开
展开全部
from xlutils.copy import copy
from xlrd import open_workbook
from xlwt import easyxf
import os
excel=r'c:/Users/fuxing/Desktop/testdata/test-insertdata.xls'
rb = open_workbook(excel,formatting_info=True)
wb = copy(rb)
sheet = wb.get_sheet(0)
#w_sheet = wb.get_sheet(0) # the sheet to write to within the writable copy
sheet.write(0, 4, '123321')
os.remove(excel)
wb.save(excel)
而且 确定你要写入的excel文件是 .xls
from xlrd import open_workbook
from xlwt import easyxf
import os
excel=r'c:/Users/fuxing/Desktop/testdata/test-insertdata.xls'
rb = open_workbook(excel,formatting_info=True)
wb = copy(rb)
sheet = wb.get_sheet(0)
#w_sheet = wb.get_sheet(0) # the sheet to write to within the writable copy
sheet.write(0, 4, '123321')
os.remove(excel)
wb.save(excel)
而且 确定你要写入的excel文件是 .xls
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询
广告 您可能关注的内容 |