Excel database module

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Garret McGraw

    Excel database module

    Has anybody heard of or know of a python module for
    reading/parsing/writing microsoft excel databases?
    Any response would be greatly appreciated.

    Thanks,
    GEM

  • Dennis Lee Bieber

    #2
    Re: Excel database module

    On Sun, 09 May 2004 18:38:04 -0400, Garret McGraw
    <garret_mcgraw@ yahoo.com> declaimed the following in comp.lang.pytho n:
    [color=blue]
    > Has anybody heard of or know of a python module for
    > reading/parsing/writing microsoft excel databases?
    > Any response would be greatly appreciated.
    >[/color]
    Assuming this is meant to run on a Windows system that also has
    Excel installed, the common view is: let Excel do the work -- ie, use
    the win32 python extensions to access the Excel system as a COM object
    (hope I have the proper terminology -- I've not done it).

    --[color=blue]
    > =============== =============== =============== =============== == <
    > wlfraed@ix.netc om.com | Wulfraed Dennis Lee Bieber KD6MOG <
    > wulfraed@dm.net | Bestiaria Support Staff <
    > =============== =============== =============== =============== == <
    > Home Page: <http://www.dm.net/~wulfraed/> <
    > Overflow Page: <http://wlfraed.home.ne tcom.com/> <[/color]

    Comment

    • Brian Kelley

      #3
      Re: Excel database module

      Dennis Lee Bieber wrote:[color=blue]
      > On Sun, 09 May 2004 18:38:04 -0400, Garret McGraw
      > <garret_mcgraw@ yahoo.com> declaimed the following in comp.lang.pytho n:
      >
      >[color=green]
      >>Has anybody heard of or know of a python module for
      >>reading/parsing/writing microsoft excel databases?
      >>Any response would be greatly appreciated.
      >>[/color][/color]
      I have not found a good reader yet, although there is a capable writer here:

      Download pyXLWriter for free. pyXLWriter is a Python library for generating Excel compatible spreadsheets. It's a port of John McNamara's Perl Spreadsheet::WriteExcel 1.0 module (see http://www.cpan.org) to Python.


      There is a perl module that can read and write excel documents that this
      package is based on.

      If you follow the COM route, do your self a favor and pick up a copy of
      Python Win32 Programming.

      Brian

      Comment

      • Thomas Guettler

        #4
        Re: Excel database module

        Am Sun, 09 May 2004 18:38:04 -0400 schrieb Garret McGraw:
        [color=blue]
        > Has anybody heard of or know of a python module for
        > reading/parsing/writing microsoft excel databases?
        > Any response would be greatly appreciated.[/color]

        Hi,

        you can store the files as xml and process this.

        Maybe this helps you:


        Thomas



        Comment

        • Cy Edmunds

          #5
          Re: Excel database module

          "Garret McGraw" <garret_mcgraw@ yahoo.com> wrote in message
          news:mailman.38 2.1084143082.25 742.python-list@python.org ...[color=blue]
          > Has anybody heard of or know of a python module for
          > reading/parsing/writing microsoft excel databases?
          > Any response would be greatly appreciated.
          >
          > Thanks,
          > GEM
          >[/color]

          If you really mean "database" you can do whatever you like using odbc. Fire
          up your Data Sources program (under Control Panel/Administrative Tools in
          XP) and do an Add/Microsoft Excel Driver. You will have to browse for the
          Excel file and give the connection a name. Let's say you pick "Melvin". Then
          in Python:

          import odbc
          import dbi
          dbc = odbc.odbc("Melv in")
          crsr = dbc.cursor()
          sql = "select foo from bar;"
          crsr.execute(sq l)
          print crsr.fetchone()
          dbc.close()

          "bar" is a named range in the workbook which contains column headings, one
          of which is "foo". If it looks like:

          foo baz bref
          2 3 5
          7 9 1

          your program will print out:

          (2,)

          How well does all this work in practice? No idea. I just tried it for the
          first time and all I can say is it worked OK for my trivial example.

          --
          Cy



          Comment

          Working...