+ Reply to Thread
Results 1 to 5 of 5

Help to import multiple text files to worksheets in a excel workbook

  1. #1
    Registered User
    Join Date
    08-22-2011
    Location
    London
    MS-Off Ver
    Excel 2003
    Posts
    2

    Help to import multiple text files to worksheets in a excel workbook

    Hi

    I have no programming background but have managed to record a macro to import a single text file into a worksheet.

    The code is below but
    Please Login or Register  to view this content.

    Can someone show me how to amend this so that the macro does a loop and picks up all the text files under location W:\xyz\abc\

    I did try code like below but i didnt work
    Please Login or Register  to view this content.

    Also when the save is done to the worksheet, I would like each worksheet within the spreadsheet to be called the name of the text file that has been run in? can someone please provide the code on how to do this?

    Thanks
    Last edited by Leith Ross; 08-22-2011 at 11:29 AM. Reason: Added Code Tags

  2. #2
    Registered User
    Join Date
    05-13-2011
    Location
    New Zealander in London
    MS-Off Ver
    Excel 2007
    Posts
    74

    Re: Help to import multiple text files to worksheets in a excel workbook

    I have written something which may help. The code has comments to explain what it is doing. Let me know if any changes are required, or if you're happy to take it from there.
    Attached Files Attached Files

  3. #3
    Registered User
    Join Date
    08-22-2011
    Location
    London
    MS-Off Ver
    Excel 2003
    Posts
    2

    Re: Help to import multiple text files to worksheets in a excel workbook

    This is great thank you, there is only thing i have not been able to get working. Currently the files I importing are the process output of servers (ps- aef on linux).

    At the moment the rows of data in my file are all imported into one column like
    Column A
    root 2168 1 0 Aug07 ? 00:00:03 /usr/sbin/automount --timeout=60 /apps yp auto.apps
    root 2463 1 0 Aug07 ? 00:00:02 /usr/sbin/automount --timeout=60 /data yp auto.data

    but i actually want to split this info as per the tabs in the file across several columns as per the tabs in the text file so i can filter columns more easily.

    I got the code from the macro when it imports the file with fixed width columns via an external import and added it to the code but it still will not import the data across several columns. I havent been able to understand why this is.

    The code i placed in was

    .TextFileColumnDataTypes = Array(1, 1, 1, 1, 1, 1, 1, 1)
    .TextFileFixedColumnWidths = Array(8, 6, 8, 1, 6, 6, 13)

  4. #4
    Registered User
    Join Date
    09-06-2011
    Location
    London
    MS-Off Ver
    Office for mac 2011
    Posts
    4

    Re: Help to import multiple text files to worksheets in a excel workbook

    Quote Originally Posted by tarquinious View Post
    I have written something which may help. The code has comments to explain what it is doing. Let me know if any changes are required, or if you're happy to take it from there.
    Hi Clever Excel people,

    I've tried to use this macro but nowt happens when I press the button (I'm assuming you have to press the 'import text Files' Button). I think maybe because I am using excel for mac 2011. Can I modify anything to make it work for me?

    Many thanks.

    sarah

  5. #5
    Registered User
    Join Date
    10-31-2011
    Location
    california, US
    MS-Off Ver
    Excel 2003
    Posts
    1

    Re: Help to import multiple text files to worksheets in a excel workbook

    hi..i am trying to import multiple .ldif files into excel..the plan is to eventually upload this onto the access database..but i feel it would be easier to upload this onto excel first..so the file is of the format


    dn: radiusname=KEVIN,radiusclass=Native-User,o=radius

    changetype: add

    objectclass: top

    objectclass: Native-User

    objectclass: user

    radiusname: KEVIN

    password: {x-clear}secret1

    profile: ISDN

    login-limit: 2


    with the field before the : as column header and the field after the : as the value..there are 19000 separate .ldif files that i need to import..i tried running a macro which imports the values as to separate columns and then applied a transpose on the same..i did this via a macro..but this was just for 1 file..i need to to this with 19000 files..so if anyone is familiar with multiple .ldif import to excel please let me know...quick replies would be appreciated as this is kind of urgent..
    Last edited by sriganesh.ravi; 10-31-2011 at 06:04 PM.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Tags for this Thread

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