Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #71812 > unrolled thread

Reading OpenOffice spreadsheet in Python?

Started bySkip Montanaro <skip@pobox.com>
First post2014-05-20 11:38 -0500
Last post2014-05-21 09:24 -0500
Articles 7 — 3 participants

Back to article view | Back to comp.lang.python


Contents

  Reading OpenOffice spreadsheet in Python? Skip Montanaro <skip@pobox.com> - 2014-05-20 11:38 -0500
    Re: Reading OpenOffice spreadsheet in Python? Martin Manns <mmanns@gmx.net> - 2014-05-20 21:45 +0200
      Re: Reading OpenOffice spreadsheet in Python? Skip Montanaro <skip@pobox.com> - 2014-05-20 17:08 -0500
    Re: Reading OpenOffice spreadsheet in Python? Rustom Mody <rustompmody@gmail.com> - 2014-05-20 18:19 -0700
      Re: Reading OpenOffice spreadsheet in Python? Skip Montanaro <skip@pobox.com> - 2014-05-20 20:33 -0500
    Re: Reading OpenOffice spreadsheet in Python? Rustom Mody <rustompmody@gmail.com> - 2014-05-21 01:53 -0700
      Re: Reading OpenOffice spreadsheet in Python? Skip Montanaro <skip@pobox.com> - 2014-05-21 09:24 -0500

#71812 — Reading OpenOffice spreadsheet in Python?

FromSkip Montanaro <skip@pobox.com>
Date2014-05-20 11:38 -0500
SubjectReading OpenOffice spreadsheet in Python?
Message-ID<mailman.10158.1400603888.18130.python-list@python.org>
I don't have Windows and since upgrading my Mac to Mavericks I no
longer have Excel of any flavor. I have a few Excel spreadsheets in
which I store parameters from which I generate other config files. I
read those spreadsheets using xlrd.

I am so fed up with LibreOffice's inability to properly support really
basic Excel capabilities, I'm about ready to throw my computer out the
window. So, I'm looking for alternatives. Before someone suggests
config parser/Windows INI files... A spreadsheet format is kinda handy
in this case because I do use a few formulas to define some of the
parameters. Adding a new row (new config file) or column (new
parameter) is a breeze. The simplest solution would seem to be to
submit to LibreOffice's terror and just start saving my spreadsheets
in OpenDocument format. That then puts me in the market for an xlrd
replacement. Is there something akin to xlrd for OpenDocument
spreadsheets? I see a couple possibilities in PyPI (exodf, odfpy), but
none which have a really high weight (suggesting they are "category
killers").

I'm open to other options as well. I see a number of Google
spreadsheet modules, and there is pyspread. The former has the
permission issue (besides, where I work everything goes into Git), and
I'm not sure how full-featured or stable the latter is (but, will
investigate).

Thx,

Skip

[toc] | [next] | [standalone]


#71828

FromMartin Manns <mmanns@gmx.net>
Date2014-05-20 21:45 +0200
Message-ID<20140520214515.1089e2c7@Fuddel>
In reply to#71812
On Tue, 20 May 2014 11:38:06 -0500
Skip Montanaro <skip@pobox.com> wrote:

> I am so fed up with LibreOffice's inability to properly support really
> basic Excel capabilities, I'm about ready to throw my computer out the

Could you please give some examples, what basic Excel capabilities you
are missing?

> I'm open to other options as well. I see a number of Google
> spreadsheet modules, and there is pyspread. The former has the
> permission issue (besides, where I work everything goes into Git), and
> I'm not sure how full-featured or stable the latter is (but, will
> investigate).

Maybe gnumeric may be an option, too.

Pyspread should run fine on the Mac. However, Macs are not officially
supported because there are no testers for OSX, yet.

Please note that pyspread does not translate Excel "xls" files into
Python but only imports cell contents and formatting via xlrd. If you
use Excel cell functions or VBA then you would have to migrate your
code to Python.


Martin

[toc] | [prev] | [next] | [standalone]


#71830

FromSkip Montanaro <skip@pobox.com>
Date2014-05-20 17:08 -0500
Message-ID<mailman.10173.1400623700.18130.python-list@python.org>
In reply to#71828
On Tue, May 20, 2014 at 2:45 PM, Martin Manns <mmanns@gmx.net> wrote:
>> I am so fed up with LibreOffice's inability to properly support really
>> basic Excel capabilities, I'm about ready to throw my computer out the
>
> Could you please give some examples, what basic Excel capabilities you
> are missing?

That's the problem. It's not that it's obviously missing some
features. It's that the files it writes sometimes are misinterpreted
by xlrd. (Maybe the problem is xlrd, but it never has a problem with
actual Excel-generated XLS files.)

For example, I use a formula to generate a sequence of strings in one column:

    "F0", "G0", "H0", ..., "Z0", "F1", "G1", ...

continuing for as long as I have data in an adjoining column. If I add
or delete rows, this sequence grows and shrinks. It looks fine in the
spreadsheet. I rarely, if ever, change the number of rows, so the
values in this column rarely, if ever, change. Still, sometimes when
xlrd reads the values out of that column it finds all cells in that
column contain the number 0. If I mess around with the spreadsheet in
ways which are apparently unrelated to this column, I can sometimes
get it to read right, sort of like hitting a jukebox to stop a record
from skipping.

I haven't tried changing the output format to XLSX format (isn't that
a compressed XML document?), but maybe I should give that a whirl. I
don't know if xlrd will read such files (at first blush, it appears
not).

Also, Mac isn't my primary platform. This problem occurs using the
Linux version of LibreOffice as well. Sometimes I edit this
spreadsheet from home though. Before I upgraded to OS X Mavericks, I
still had an ancient version of Excel for Mac which worked fine
(despite all the disparaging remarks I've seen over the years about
that product). Once I upgraded though, that was no longer an option.

Thanks for the gnumeric and pyspread suggestions. I thought gnumeric
was a long dead project, but see that it's available for my Mac, so
I'll try that right off. I'll also play around with pyspread and see
how that does. I don't mind rewriting my couple of formulas, though I
will no longer be able to rely on the Excel experts at work. :-)

Skip

[toc] | [prev] | [next] | [standalone]


#71835

FromRustom Mody <rustompmody@gmail.com>
Date2014-05-20 18:19 -0700
Message-ID<638bcc73-e627-4c25-91af-8a46e87a45b1@googlegroups.com>
In reply to#71812
On Tuesday, May 20, 2014 10:08:06 PM UTC+5:30, Skip Montanaro wrote:
> I don't have Windows and since upgrading my Mac to Mavericks I no
> longer have Excel of any flavor. I have a few Excel spreadsheets in
> which I store parameters from which I generate other config files. I
> read those spreadsheets using xlrd.

> I am so fed up with LibreOffice's inability to properly support really
> basic Excel capabilities, I'm about ready to throw my computer out the
> window. So, I'm looking for alternatives. Before someone suggests
> config parser/Windows INI files... A spreadsheet format is kinda handy
> in this case because I do use a few formulas to define some of the
> parameters. Adding a new row (new config file) or column (new
> parameter) is a breeze. 

Are you familiar with emacs' org mode tables?

http://orgmode.org/org.html#Tables

[toc] | [prev] | [next] | [standalone]


#71837

FromSkip Montanaro <skip@pobox.com>
Date2014-05-20 20:33 -0500
Message-ID<mailman.10177.1400636013.18130.python-list@python.org>
In reply to#71835

[Multipart message — attachments visible in raw view] — view raw

> Are you familiar with emacs' org mode tables?

> http://orgmode.org/org.html#Tables

No. Thanks for the pointer.

S

[toc] | [prev] | [next] | [standalone]


#71845

FromRustom Mody <rustompmody@gmail.com>
Date2014-05-21 01:53 -0700
Message-ID<21575b32-1d21-4a9c-8a72-c8735d1630d9@googlegroups.com>
In reply to#71812
On Tuesday, May 20, 2014 10:08:06 PM UTC+5:30, Skip Montanaro wrote:
> I don't have Windows and since upgrading my Mac to Mavericks I no
> longer have Excel of any flavor. I have a few Excel spreadsheets in
> which I store parameters from which I generate other config files. I
> read those spreadsheets using xlrd.

> I am so fed up with LibreOffice's inability to properly support really
> basic Excel capabilities, I'm about ready to throw my computer out the
> window.

Another possibility: Use google drive/docs spreadsheet capability.
Makes much less mess than libreoffice and will export to standard formats

[toc] | [prev] | [next] | [standalone]


#71857

FromSkip Montanaro <skip@pobox.com>
Date2014-05-21 09:24 -0500
Message-ID<mailman.10191.1400682292.18130.python-list@python.org>
In reply to#71845
On Wed, May 21, 2014 at 3:53 AM, Rustom Mody <rustompmody@gmail.com> wrote:
> Another possibility: Use google drive/docs spreadsheet capability.
> Makes much less mess than libreoffice and will export to standard formats

Correct, though it separates my spreadsheet from the Git repository,
and means anyone else at work who might work on this stuff would need
to be granted access. Not insurmountable problems, but not great
either.

I tried Gnumeric today. The first edits caused no problems. Knock on wood...

Skip

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web