ooolib, reading writing a spread sheet and keep formatting
News123
news1234 at free.fr
Thu Apr 29 04:17:20 EDT 2010
Kushal Kumaran wrote:
> On Thu, Apr 29, 2010 at 5:46 AM, News123 <news1234 at free.fr> wrote:
>> Hi,
>>
>> I'm making first attempts to modify a few cells of an openoffice
>> spreadsheet.
>>
>
> Try the xlrd and xlwt modules, and the documentation at
> http://www.python-excel.org/
Thanks Kumar,
I installed xlrd, xlwt and xlsutils
Now I'm stuck with exactly the same probem, that I had with ooolib.
The newly written file lost all formating and replaced formulas with the
calculated values.
Does anyone have a simple example, which reads a file, modifies one cell
and writes out WITHOUT oss of formatting / formulas?
from xlrd import open_workbook
from xlutils.copy import copy
rb = open_workbook('doc1.xls')
print "WB with %d sheets" % rb.nsheets
wb = copy(rb)
wb.save("doc2.xls") # file is created, but ALL formattng is lost and
formulas are now diplayed as text
>
>> <snip>
>
More information about the Python-list
mailing list