+ Reply to Thread
Results 1 to 6 of 6

Extracting cell data from numerous files in multiple folders????

Hybrid View

Guest Extracting cell data from... 03-22-2006, 06:50 PM
Guest RE: Extracting cell data from... 03-22-2006, 09:25 PM
Guest Re: Extracting cell data from... 03-22-2006, 10:45 PM
Guest Re: Extracting cell data from... 03-22-2006, 10:55 PM
Guest Re: Extracting cell data from... 03-22-2006, 11:15 PM
Guest RE: Extracting cell data from... 03-22-2006, 10:15 PM
  1. #1
    JoeJoe
    Guest

    Extracting cell data from numerous files in multiple folders????

    Hello - let me preface this post by stating that I am a novice in
    regards to Macro programming. That being stated, here's my issue.

    Every month, we receive hundreds of Excel files from various business
    units. The filenames are always different and they change
    month-to-month, but the template format they use to input their data is
    the same across the board. Thus, for example, cell A1 always contains
    an account number within all these files, cell A2 contains a name, etc.

    Each workbook includes two separate tabs. What I need to be able to do
    is automatically extract data within specific cells for all these
    workbooks. Currently the files are in four separate folders, but they
    could be moved into one if that was an issue.

    Thanks for your suggestions.


  2. #2
    Joseph in Atlanta
    Guest

    RE: Extracting cell data from numerous files in multiple folders????

    Hello JoeJoe, this is Joseph in Atlanta

    You COULD go ahead and write some VBA code to open hundreds of Excel
    spreadsheets, in different directories, and collect together your data from
    ALL
    of them... but you've mentioned that you are not a VBA programmer.

    I might suggest some other options:

    The "Perl" language is capable of reading and writing Excel Spreadsheet files.
    It could chew through hundreds of dirs/folders, reading all of the Excel
    found,
    and gathering data into another summary file. The summary could be an almost
    any format you wanted, from another Excel.XLS to flat file, to dBase, to
    CSV, etc.

    Look here for examples:
    http://homepage.eircom.net/~jmcnamar...riteExcel.html
    http://search.cpan.org/~isterin/XML-Excel-0.02/Excel.pm
    http://www-128.ibm.com/developerwork...rary/l-pexcel/
    http://www.annocpan.org/~KWITKNR/DBD...-0.06/Excel.pm
    http://wiki.tcl.tk/3441
    http://mike.kruckenberg.com/archives...nd_spread.html

    http://groups.google.com/group/perl....7c0f991a94cbc9

    The Perl scripting language wil run on Wondows, Unix, and almost any system
    you
    can find. It's very powerfull, but may take a bit of time to get used to.
    ( though probably less than Visual Basic, for this sort of task )

    You can find other possibilities here:

    http://en.wikipedia.org/wiki/Microso...APIs_and_tools

    including the use of Java with Excel data:
    http://andykhan.com/jexcelapi/index.html
    or other tools, for teh "C" language: http://chicago.sourceforge.net/xlhtml/
    even web-site PhP modules:
    http://sourceforge.net/projects/phpexcelreader/
    http://nslog.com/archives/2004/03/24...el_via_php.php

    I hope this gives you something to work with...

    Joseph in Atlanta


    "JoeJoe" wrote:

    > Hello - let me preface this post by stating that I am a novice in
    > regards to Macro programming. That being stated, here's my issue.
    >
    > Every month, we receive hundreds of Excel files from various business
    > units. The filenames are always different and they change
    > month-to-month, but the template format they use to input their data is
    > the same across the board. Thus, for example, cell A1 always contains
    > an account number within all these files, cell A2 contains a name, etc.
    >
    > Each workbook includes two separate tabs. What I need to be able to do
    > is automatically extract data within specific cells for all these
    > workbooks. Currently the files are in four separate folders, but they
    > could be moved into one if that was an issue.
    >
    > Thanks for your suggestions.
    >
    >


  3. #3
    Harlan Grove
    Guest

    Re: Extracting cell data from numerous files in multiple folders????

    Joseph in Atlanta wrote...
    ....
    > of them... but you've mentioned that you are not a VBA programmer.
    >
    >I might suggest some other options:
    >
    >The "Perl" language is capable of reading and writing Excel Spreadsheet files.
    >It could chew through hundreds of dirs/folders, reading all of the Excel
    >found, and gathering data into another summary file. The summary could be an
    >almost any format you wanted, from another Excel.XLS to flat file, to dBase, to
    >CSV, etc.

    ....

    If the OP can't program in VBA, is it reasonable to assume he could
    program in Perl? If the OP had to learn a language from scratch, VBA is
    easier to learn than Perl.

    There are relatively simple techniques for pulling information from
    multiple spreadsheets in batch *WITHOUT* VBA, just using formulas. One
    possibility is alternative 1 in the following archived article.

    http://groups.google.com/group/micro...443753560f0075

    (or http://makeashorterlink.com/?B34B15DCC ).


  4. #4
    JMB
    Guest

    Re: Extracting cell data from numerous files in multiple folders??

    >>The filenames are always different and they change
    >>month-to-month


    Wouldn't it be a hassle to use formulae if the workbook names are not
    constant?

    "Harlan Grove" wrote:

    > Joseph in Atlanta wrote...
    > ....
    > > of them... but you've mentioned that you are not a VBA programmer.
    > >
    > >I might suggest some other options:
    > >
    > >The "Perl" language is capable of reading and writing Excel Spreadsheet files.
    > >It could chew through hundreds of dirs/folders, reading all of the Excel
    > >found, and gathering data into another summary file. The summary could be an
    > >almost any format you wanted, from another Excel.XLS to flat file, to dBase, to
    > >CSV, etc.

    > ....
    >
    > If the OP can't program in VBA, is it reasonable to assume he could
    > program in Perl? If the OP had to learn a language from scratch, VBA is
    > easier to learn than Perl.
    >
    > There are relatively simple techniques for pulling information from
    > multiple spreadsheets in batch *WITHOUT* VBA, just using formulas. One
    > possibility is alternative 1 in the following archived article.
    >
    > http://groups.google.com/group/micro...443753560f0075
    >
    > (or http://makeashorterlink.com/?B34B15DCC ).
    >
    >


  5. #5
    Harlan Grove
    Guest

    Re: Extracting cell data from numerous files in multiple folders??

    JMB wrote...
    >>>The filenames are always different and they change
    >>>month-to-month

    >
    >Wouldn't it be a hassle to use formulae if the workbook names are not
    >constant?

    ....

    Depends. Some people, like me, would consider it fairly simple and
    painless to use a console prompt to run a command like

    dir <x>\*.xls /b /s /a:-d > xlsfilelist.txt

    to create a text file containing all .XLS filenames in the directory
    <x> (a placeholder) and all its subdirectories. Relatively simple to
    import text files into Excel template workbooks, and given reasonable
    formula techniques, relatively simple to generate a dynamic table of
    external reference formulas from a variable size table of filenames.

    That said, it'd be A LOT easier and a lot more flexible to correct cell
    referrences in text formulas than hardcoded into VBA macros.


  6. #6
    JMB
    Guest

    RE: Extracting cell data from numerous files in multiple folders????

    Maybe this will help provide some framework to get you started. Assuming all
    files are in C:\Excel, you wanted cells A1, B1, and C1 from the first
    worksheet of each workbook, and you wanted to put this data into the first
    worksheet of your destination workbook (beginning in cell A1, B1, and C1) then

    Sub test()
    Const Path = "C:\Excel"
    Dim WkBk As Workbook
    Dim i As Long

    On Error Resume Next
    Application.EnableEvents = False

    With Application.FileSearch
    .NewSearch
    .LookIn = Path
    .Filename = "*.xls"
    .Execute
    For i = 1 To .FoundFiles.Count
    Set WkBk = Workbooks.Open(.FoundFiles(i))
    With ThisWorkbook.Worksheets(1)
    .Cells(i, 1).Value = _
    WkBk.Worksheets(1).Range("A1").Value
    .Cells(i, 2).Value = _
    WkBk.Worksheets(1).Range("B1").Value
    .Cells(i, 3).Value = _
    WkBk.Worksheets(1).Range("C1").Value
    .Cells(i, 4).Value = _
    WkBk.FullName
    End With
    WkBk.Close savechanges:=False
    Next i
    End With

    End Sub



    This is the section you may need to modify. This snippet is instructing
    Excel to copy cell A1 of the first worksheet of your source workbook into the
    first worksheet of your destination workbook (which is the workbook that
    contains the macro). " i " is a counter variable that starts at 1. It
    increments each time a workbook is opened and is used to determine in what
    row to put the incoming data. Therefore, when the first book is opened,
    ..Cells(i, 1) specifies the first row and first column of Worksheets(1) - the
    first worksheet. If it is possible the clients may have moved the worksheets
    around, you can change Worksheets(1) to Worksheets("SheetNameHere")

    With ThisWorkbook.Worksheets(1)
    .Cells(i, 1).Value = _
    WkBk.Worksheets(1).Range("A1").Value





    "JoeJoe" wrote:

    > Hello - let me preface this post by stating that I am a novice in
    > regards to Macro programming. That being stated, here's my issue.
    >
    > Every month, we receive hundreds of Excel files from various business
    > units. The filenames are always different and they change
    > month-to-month, but the template format they use to input their data is
    > the same across the board. Thus, for example, cell A1 always contains
    > an account number within all these files, cell A2 contains a name, etc.
    >
    > Each workbook includes two separate tabs. What I need to be able to do
    > is automatically extract data within specific cells for all these
    > workbooks. Currently the files are in four separate folders, but they
    > could be moved into one if that was an issue.
    >
    > Thanks for your suggestions.
    >
    >


+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1