Results 1 to 2 of 2
  1. #1
    NoiCe is offline Novice
    Windows XP Access 2007
    Join Date
    Nov 2008
    Posts
    24

    Importing multiple files at once

    Hello,

    I really need some help. I am looking for an easy way to import multiple files (50+) Pipe Delimited txt files into a table (Append to all 1 table) so I can do some data manipulation. All the files have a different file name; however, have the same layout. I am not too familiar with VBA. Can anyone please help?

    Thank you very much.

  2. #2
    Join Date
    Apr 2009
    Posts
    1

    Re: Importing multiple files at once

    Here are a couple of ideas. These scripts are in biterscripting (http://www.biterscripting.com for free download) .

    To put 50+ files with the same layout into one file:

    Code:
     
    cat file1 > "C:/MasterFile.psv"
    cat file2 >> "C:/MasterFile.psv"
    .
    .
    .
    If there is a certain theme beghind these input file names, paths, etc. , you can code that logic into above code.

    I am calling the MasterFile .psv for Pipe-Separated-Values.

    You did not say what kind of data manipulation - here is one example. Let's say you want to add up field 5 (an int value) in the MasterFile.psv. Here is a script for that.

    Code:
     
    set $wsep="|"     # Field Separator
     
    var int itotal5
     
    # Read in MasterFile
    var str records ; cat "C:/MasterFile.psv" > $records
     
    # Read one record at a time
    while ($records <> "")
    do
        var str record ; lex -e "1" $records > $record
     
        # Get the 5th field.
        var str field ; wex -e "5" $record > $field
     
        # Conver to int
        var int ifield ; set $ifield = makeint(str($field))
     
        # Add to total
        set $itotal5 = $itotal5 + $ifield
    done
     
    # Print total of field 5
    echo "THE SUM TOTAL OF FIELD 5 IS " $itotal5
    If you need to do this periodically, just put these scripts into a file (C:/WeeklyScript.txt) and call that script from your periodic batch process as follows.

    Code:
    C:/biterScripting/biterScripting.exe "C:/WeeklyScript.txt"

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Importing Xls and CSV files into MS Access
    By Jeff in forum Import/Export Data
    Replies: 1
    Last Post: 02-17-2009, 11:56 PM
  2. relink to relative path TXT data files
    By tobynegus in forum Programming
    Replies: 0
    Last Post: 08-19-2008, 10:10 AM
  3. Access Question regarding JPEG files
    By amosstarz in forum Security
    Replies: 1
    Last Post: 09-01-2006, 04:17 PM
  4. Replies: 1
    Last Post: 07-09-2006, 09:23 AM
  5. Import multiple dbf files into existing table?
    By sbg2 in forum Import/Export Data
    Replies: 0
    Last Post: 06-12-2006, 02:06 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums