+ Reply to Thread
Results 1 to 6 of 6

Copying multiple text files from a folder into excel

  1. #1
    Registered User
    Join Date
    02-19-2014
    Location
    singapore
    MS-Off Ver
    Excel 2003
    Posts
    11

    Copying multiple text files from a folder into excel

    Hey all,

    I currently have 10 text files in a folder. Is there a way to loop such that I can copy all of these text documents into a single excel spreadsheet? These text files are randomly named and do not have any specific order.

    Appreciate the help.

  2. #2
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 insider Version 2504 Win 11
    Posts
    24,694

    Re: Copying multiple text files from a folder into excel

    Are there any other files in the folder?

    Will each text file go into a separate worksheet in the workbook? or will they all go into the same sheet?

    Are the text files formatted the same? Are they .txt files or .csv files?

    It is possible, but as you can surmise from my questions, your information is to vague to tell you how or supply a valid solution.
    Alan עַם יִשְׂרָאֵל חַי


    Change an Ugly Report with Power Query
    Database Normalization
    Complete Guide to Power Query
    Man's Mind Stretched to New Dimensions Never Returns to Its Original Form

  3. #3
    Registered User
    Join Date
    02-19-2014
    Location
    singapore
    MS-Off Ver
    Excel 2003
    Posts
    11

    Re: Copying multiple text files from a folder into excel

    Hi Alan,

    Apologies for the vagueness.

    Each text file will go into the same worksheet.
    The files are all .txt files.

    The main issue I have is trying to loop the entry of text documents into the single worksheet, and this is because they are all named differently.

  4. #4
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 insider Version 2504 Win 11
    Posts
    24,694

    Re: Copying multiple text files from a folder into excel

    The main issue I have is trying to loop the entry of text documents into the single worksheet, and this is because they are all named differently.
    Do you have some code that you have started and can be analyzed rather than start from scratch?

  5. #5
    Registered User
    Join Date
    02-19-2014
    Location
    singapore
    MS-Off Ver
    Excel 2003
    Posts
    11

    Re: Copying multiple text files from a folder into excel

    Haven't started on it yet.
    I'm currently at work and will write the script when I get home tonight.

    Google has been great in providing the solutions for the intermediate steps, but I just can't get the looping part down.

  6. #6
    Registered User
    Join Date
    02-19-2014
    Location
    singapore
    MS-Off Ver
    Excel 2003
    Posts
    11

    Re: Copying multiple text files from a folder into excel

    Here is a sample of the text file that I am using:

    Company Name: Pears Galore
    Revenue: $500,000

    The code

    Please Login or Register  to view this content.
    I took this code off someone else and edited to make it mine. However, I am not sure what can be done to make it loop for multiple text files, and insert the revenue figures into a column.
    Is it also possible to automatically input the file path and name? or would this have to be done manually?
    Last edited by WinningKing; 02-20-2014 at 08:49 AM.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Replies: 0
    Last Post: 09-16-2013, 02:24 AM
  2. copying data from excel files in a source folder to target folder
    By Javed07 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 02-22-2013, 04:27 PM
  3. Multiple Files in a folder - Copying to one file
    By ingwingfingerling in forum Excel Programming / VBA / Macros
    Replies: 11
    Last Post: 12-31-2012, 04:57 PM
  4. Copying data from multiple files in a folder to a master file
    By kjshep in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 10-22-2012, 12:31 PM
  5. Replies: 1
    Last Post: 02-29-2012, 01:15 PM

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