Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

python xlutils : formatting_info=True not yet implemented

Tags:

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?

like image 719
user1891854 Avatar asked Dec 15 '12 12:12

user1891854


1 Answers

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.

like image 190
Amelse Etomer Avatar answered Oct 06 '22 04:10

Amelse Etomer