Extract Data from Excel-files

Ask a Question related to PERL Beginners, Design and Development.

  1. #1

    Default Extract Data from Excel-files

    Hello everyone,

    Finally I get to use perl at work! =)
    I am to facing the following problem:

    There is a folder on a file-server in our network which contains 60 - 70
    subfolders. Each of these subfolders contains a number of Excel-files
    (.xls) ranging from zero to maybe five.
    Each of these files again contains several worksheets, from which I am
    to extract certain cells (these are at fixed positions) and somehow put
    these to some nice output format (csv, html, maybe an SQL-database).

    As of now, I am more concerned about extracting the data.
    There is a module, Spreadsheet::ParseExcel, which I've tried out, and it
    seems to work. But the documentation says it can not handle all versions
    of excel.
    I am unsure what versions of Excel were used creating these files,
    probably Excel 2000 and XP.
    I'm going to try Spreadsheet::ParseExcel first, but if it does not work
    - what other ways to access Excel-files are there? What reasons could
    you think of to prefer one way over the other(s)?

    Thanks for your suggestions,

    kind regards,

    Benjamin
    Benjamin Walkenhorst Guest

  2. Similar Questions and Discussions

    1. How to extract multilingual to MS Excel
      How can I extract multilingual data into MS Excel application. At the moment the data extracted into Excel file is not readable. Currently using...
    2. extract record from database to notepad or excel
      Hi.. Have anyone can help me how to extract data from my db to notepad or excel..? is there any tools in Dw to do this?
    3. Fixed Length Text Extract, Write to Excel
      Hello All, I am trying to work with the code I have to extract fields from a text file report, and write the values into excel. I am having...
    4. Is PHP able to extract data out of an Excel spreadsheet?
      The only form of database we use is an Excel database. Otherwise is it possible to import the relevant spreadsheet data into say MySQL? Perhaps it...
    5. Extending client to access Excel files (most data still in SQL Server)
      We are building a general query tool for accessing data in our company. The primary data source we access is SQL Server running on a remote host,...
  3. #2

    Default FW: Extract Data from Excel-files

    Ben,

    I have been able to use Spreadsheet::ParseExcel with 2000 and XP XL
    files. I'm not an Excel expert but if I am not mistaken 2000 and XP use
    the same file structure. The complications might arise with XP 2003, or
    97 files. A simple work around would be to open/close all spreadsheets
    with one version of Excel. For a definite answer I would recommend that
    you send an email to the modules author (I forget his name) but I found
    him to be pleasant and responsive when I was using the module and had
    questions.

    Shaun


    -----Original Message-----
    From: Benjamin Walkenhorst [mailto:krylon@gmx.net]
    Sent: Sunday, February 15, 2004 5:25 AM
    To: [email]beginners@perl.org[/email]
    Subject: Extract Data from Excel-files


    Hello everyone,

    Finally I get to use perl at work! =)
    I am to facing the following problem:

    There is a folder on a file-server in our network which contains 60 - 70
    subfolders. Each of these subfolders contains a number of Excel-files
    (.xls) ranging from zero to maybe five.
    Each of these files again contains several worksheets, from which I am
    to extract certain cells (these are at fixed positions) and somehow put
    these to some nice output format (csv, html, maybe an SQL-database).

    As of now, I am more concerned about extracting the data.
    There is a module, Spreadsheet::ParseExcel, which I've tried out, and it
    seems to work. But the documentation says it can not handle all versions
    of excel. I am unsure what versions of Excel were used creating these
    files, probably Excel 2000 and XP. I'm going to try
    Spreadsheet::ParseExcel first, but if it does not work
    - what other ways to access Excel-files are there? What reasons could
    you think of to prefer one way over the other(s)?

    Thanks for your suggestions,

    kind regards,

    Benjamin

    --
    To unsubscribe, e-mail: [email]beginners-unsubscribe@perl.org[/email]
    For additional commands, e-mail: [email]beginners-help@perl.org[/email]
    <http://learn.perl.org/> <http://learn.perl.org/first-response>


    Shaun Bramley Guest

  4. #3

    Default Re: FW: Extract Data from Excel-files

    Hello,

    On Sun, 15 Feb 2004 10:18:56 -0500
    "Shaun Bramley" <s_bramley@hotmail.com> wrote:
    > Ben,
    >
    > I have been able to use Spreadsheet::ParseExcel with 2000 and XP XL
    > files. I'm not an Excel expert but if I am not mistaken 2000 and XP
    > use the same file structure. The complications might arise with XP
    > 2003, or 97 files. A simple work around would be to open/close all
    > spreadsheets with one version of Excel. For a definite answer I would
    > recommend that you send an email to the modules author (I forget his
    > name) but I found him to be pleasant and responsive when I was using
    > the module and had questions.
    >
    > Shaun
    Thank you very much, that sounds very encouraging! =)
    I'm just *so* glad I don't have to learn VBA or something like that...
    Being able to use perl for this task fits in really nice, because I have
    been using perl quite a lot on my local machines recently.

    Kind regards,
    Benjamin
    Benjamin Walkenhorst Guest

  5. #4

    Default Re: Extract Data from Excel-files

    Benjamin Walkenhorst wrote:
    > Hello everyone,
    >
    > Finally I get to use perl at work! =)
    > I am to facing the following problem:
    >
    > There is a folder on a file-server in our network which contains 60 - 70
    > subfolders. Each of these subfolders contains a number of Excel-files
    > (.xls) ranging from zero to maybe five.
    > Each of these files again contains several worksheets, from which I am
    > to extract certain cells (these are at fixed positions) and somehow put
    > these to some nice output format (csv, html, maybe an SQL-database).
    >
    > As of now, I am more concerned about extracting the data.
    > There is a module, Spreadsheet::ParseExcel, which I've tried out, and it
    > seems to work. But the documentation says it can not handle all versions
    > of excel.
    > I am unsure what versions of Excel were used creating these files,
    > probably Excel 2000 and XP.
    > I'm going to try Spreadsheet::ParseExcel first, but if it does not work
    > - what other ways to access Excel-files are there? What reasons could
    > you think of to prefer one way over the other(s)?
    >
    > Thanks for your suggestions,
    >
    > kind regards,
    >
    > Benjamin
    It is probably blasphemous to say this here, but if I was facing a mass of
    Excel, or any other M$ Office files, I would just use VB. It has the advantage
    of placement. It has immediate access to the built-in functionality. Here is
    the VB for a single file open and resave as CSV:

    Sub Macro2()
    '
    Workbooks.Open Filename:="E:\d_drive\job\Lab Software.xls"
    ActiveWorkbook.SaveAs Filename:="E:\d_drive\job\Lab Software.csv", _
    FileFormat:=xlCSV, CreateBackup:=False
    End Sub

    When you think out the logic for how to collect the input and output filenames
    and paths, that should be fairly straightforward.

    I got the above syntax by recording a macro and then opening the macro widow,
    and choosing Edit. Toss in some logic for filename collection and looping, and
    then it just takes a keypress.

    Then you can use Perl to prodess the SCV output, since this is a task at which
    Perl excels.

    Joseph

    Joseph


    R. Joseph Newton Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139