From: News123 on 29 Apr 2010 15:58 cjw wrote: > On 28-Apr-10 23:18 PM, Kushal Kumaran wrote: >> On Thu, Apr 29, 2010 at 5:46 AM, News123<news1234(a)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/ > The tutorial here is beautifully done: > > http://python-excel.googlegroups.com/web/python-excel.pdf?gda=68Un3kIAAABrjVmXvI2FnKbK79o6Y1oCuHLcf1VKsaM-EVGjvOiGtNXEtWX7y7b6ByPnawQ3OxpV4u3aa4iAIyYQIqbG9naPgh6o8ccLBvP6Chud5KMzIQ > I agree, Reading the documentation you get very quickly an overview of what can be done. > > Does it fly with .ods files? > It works only with xls, but as OpenOffice can read and write xls this wouldn't be a problem for me. However: I'd like to read in a spreadsheet, perform only minor modifications and write it back with the exact formatting. this is unfortunately not working. N
From: Lie Ryan on 30 Apr 2010 07:10 On 04/30/10 05:58, News123 wrote: > cjw wrote: > However: > > I'd like to read in a spreadsheet, perform only minor modifications and > write it back with the exact formatting. this is unfortunately not working. Do you know that Python is one of OpenOffice's macro language? Python macro have the full access to UNO that OpenOffice itself uses internally.
From: Chris Withers on 4 May 2010 07:23 News123 wrote: > > from xlrd import open_workbook > from xlutils.copy import copy > > rb = open_workbook('doc1.xls') open_workbook('doc1.xls',formatting_info=True) > 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 cheers, Chris
From: News123 on 4 May 2010 18:07 Hi Chris, Chris Withers wrote: > News123 wrote: >> >> from xlrd import open_workbook >> from xlutils.copy import copy >> >> rb = open_workbook('doc1.xls') > > open_workbook('doc1.xls',formatting_info=True) I'll try, but the doc mentioned explicitely, that formulas will be lost. I'll keep you updated. > >> 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 > >
From: Chris Withers on 4 May 2010 18:07 News123 wrote: > Hi Chris, > > > Chris Withers wrote: >> News123 wrote: >>> from xlrd import open_workbook >>> from xlutils.copy import copy >>> >>> rb = open_workbook('doc1.xls') >> open_workbook('doc1.xls',formatting_info=True) > > I'll try, but the doc mentioned explicitely, that formulas will be lost. > I'll keep you updated. Yup, for them to be preserved, someone needs to either provide the patches or stump up the cash to get the features implemented. cheers, Chris -- Simplistix - Content Management, Batch Processing & Python Consulting - http://www.simplistix.co.uk
First
|
Prev
|
Next
|
Last
Pages: 1 2 3 Prev: CGI python 3 write RAW BINARY Next: building python 3 -- _dbm necessary bits |