+ Reply to Thread
Results 1 to 9 of 9

Importing multiple text files into one worksheet

  1. #1
    Registered User
    Join Date
    06-06-2012
    Location
    London, England
    MS-Off Ver
    Excel 2007
    Posts
    7

    Importing multiple text files into one worksheet

    Hi there,

    I am looking to import many text files into one excel sheet. (Excel 2007)

    The files are saved every hour and contain identical tab delimited columns. There are 10 columns and 4 rows in each file.

    The filenames contain the date and timestamp. I would like to import this data into column A.

    I am struggling with pieces of codes I have picked up from the web - and just can't seem to get each element working. I have exhausted every post I can find on the subject!

    Any suggestions for code would be much appreciated.

    Best,
    Rob


    Also posted on code cage - I had no idea these sites were linked - or this was an issue

    http://www.thecodecage.com/forumz/mi...post1055001033
    Last edited by gwatcheater; 07-11-2012 at 03:24 AM.

  2. #2
    Valued Forum Contributor fredlo2010's Avatar
    Join Date
    07-04-2012
    Location
    Miami, United States
    MS-Off Ver
    Excel 365
    Posts
    762

    Re: Importing multiple text files into one worksheet

    Hi,

    Is there a way you can attached a copy of your sheet and the text file. Do you want to get the data next to the previous entry or different sheets?

    You can record the macro and modify it a little to fit your needs. I think this should be more than enough.


    Thanks

  3. #3
    Registered User
    Join Date
    06-06-2012
    Location
    London, England
    MS-Off Ver
    Excel 2007
    Posts
    7

    Re: Importing multiple text files into one worksheet

    require just one summary sheet with the data in rows

    the text files are just tab delimited (There are 10 columns and 4 rows in each file)

  4. #4
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,380

    Re: Importing multiple text files into one worksheet

    Hi gwatcheater,

    Give this a whirl:

    Please Login or Register  to view this content.
    Oh - are they all in the same workbook - else we'll need to revise.
    If I've helped you, please consider adding to my reputation - just click on the liitle star at the left.

    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~(Pride has no aftertaste.)

    You can't do one thing. XLAdept

    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~aka Orrin

  5. #5
    Forum Expert snb's Avatar
    Join Date
    05-09-2010
    Location
    VBA
    MS-Off Ver
    Redhat
    Posts
    5,646

    Re: Importing multiple text files into one worksheet




  6. #6
    Forum Expert Cutter's Avatar
    Join Date
    05-24-2004
    Location
    Ontario,Canada
    MS-Off Ver
    Excel 2010
    Posts
    6,451

    Re: Importing multiple text files into one worksheet

    gwatcheater

    I'm afraid your post does not comply with Rule 8 of our Forum RULES. Cross-posting is when you post the same question in other forums on the web. You'll find people are disinclined to respond to cross-posts because they may be wasting their time solving a problem that has been solved elsewhere. We prefer that you not cross-post at all, but if you do (and it's unlikely to go unnoticed), you MUST provide a link (copy the url from the address bar in your browser)to the cross-post. Expect cross-posts without a link to be closed a message will be posted by the moderator explaining why. We are here to help so help us to help you!

    Read this to understand why we ask you to do this, and then please edit your first post to include links to any and all cross-posts in any other forums (not just this site).

  7. #7
    Registered User
    Join Date
    06-06-2012
    Location
    London, England
    MS-Off Ver
    Excel 2007
    Posts
    7

    Re: Importing multiple text files into one worksheet

    Quote Originally Posted by xladept View Post
    Hi gwatcheater,

    Give this a whirl:

    Please Login or Register  to view this content.
    Oh - are they all in the same workbook - else we'll need to revise.
    Thanks for the code - not sure how this works? does this open and paste data from any text files?

    this is what I currently have- but need to evolve:

    Please Login or Register  to view this content.
    When I run - I am prompted to open a file manually - once I select one - the import begins for all files - how can I avoid this manual step?

    I would like to add the filename of each text file to column A if possible (as these contain date and time info)

    If possible I would like to not import row 1 of each text file as it is a header


    thanks
    Rob



    (re: Crosspost - I had no idea all the forums were linked accross different sites - apologies)
    Last edited by gwatcheater; 07-11-2012 at 03:21 AM. Reason: spelling mistake

  8. #8
    Registered User
    Join Date
    06-06-2012
    Location
    London, England
    MS-Off Ver
    Excel 2007
    Posts
    7

    Re: Importing multiple text files into one worksheet

    I have had a play this morning with a fresh head

    My 2 issues are
    1) when I run the code - I am prompted to manually select one text file - before the import begins - all others are then imported
    2) I would like to add the filename to each row imported (as this contains date and time stamp)

    I have revised the code to:


    Please Login or Register  to view this content.

    any thoughts?

    thank you

  9. #9
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,380

    Re: Importing multiple text files into one worksheet

    I believe that you could just use:

    Please Login or Register  to view this content.
    to populate any cell that you designated.

+ 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