python xlutils : formatting_info=True not yet implemented

情到浓时终转凉″ 提交于 2019-11-27 02:38:32

问题


I've got simple code to copy files with xlutils, xlrd, xlwt (downloaded new libraries from python-excel.org) with not loosing formatting. I've got an error as below:

from xlwt.Workbook import *
from xlwt.Style import *
from xlrd import open_workbook
from xlutils.copy import copy
import xlrd

style = XFStyle()
rb = open_workbook('file_master.xlsx', formatting_info=True)
wb = copy(rb.get_sheet(0))

new_book = Workbook()
w_sheet = wb.get_sheet(0)
w_sheet.write(6,6)

wb.save('new_file_master.xls')

Error:

 raise NotImplementedError("formatting_info=True not yet implemented")
NotImplementedError: formatting_info=True not yet implemented

Could you please help me how to work around this or rather make it work?


回答1:


According to this thread the flag

formatting_info=True

is only working for xls-files, but not for xlsx yet (Version xlrd-0.8.0).

As a workaround you could convert the workbook to xls using Excel or OpenOffice.

It seems that a commandline conversion from xlsx to xls is possible using Unoconv on Linux, Windows and MacOSX.



来源:https://stackoverflow.com/questions/13892307/python-xlutils-formatting-info-true-not-yet-implemented

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!