+ Reply to Thread
Results 1 to 2 of 2

Automate importing of TXT files into Excel.

  1. #1
    Registered User
    Join Date
    05-09-2020
    Location
    Lima, Perú
    MS-Off Ver
    2019
    Posts
    6

    Automate importing of TXT files into Excel.

    Good night! I'd like your help with the following problem. I need to import text files that are inside several folders on multiple Excel sheets. The file structure is as follows:
    E:\Users
    E:\Users\(user_name1)\(item_name1).txt
    E:\Users\(user_name1)\(item_name2).txt
    E:\Users\(user_name1)\(item_name3).txt
    ...
    E:\Users\(user_name2)\(item_name1).txt
    E:\Users\(user_name2)\(item_name2).txt
    E:\Users\(user_name2)\(item_name3).txt
    E:\Users\(user_name2)\(item_name4).txt
    E:\Users\(user_name2)\(item_name5).txt
    ...
    E:\Users\(user_name3)\(item_name1).txt
    E:\Users\(user_name3)\(item_name2).txt
    ...
    *All item names are different, there are no duplicates.

    - The structure of txt files is super simple:
    (X) item.
    X equals the number of items.

    - Each (user_name) must be in its own Excel sheet.

    I have achieved this using Power Query (Import from folder), the problem is that I must do it MANUALLY, one by one. I have almost 200 user names (with 50-600 txt files in their respective folders), so this would take me A LOT OF TIME.
    Is there any way to automate this process?
    Attached Files Attached Files

  2. #2
    Forum Contributor
    Join Date
    03-18-2014
    Location
    Singapore
    MS-Off Ver
    Excel 2016 / 2019
    Posts
    251

    Re: Automate importing of TXT files into Excel.

    Hi, I saw you are using binary, i.e. you expand the content file directly to let PQ auto transform for you (actually I did it before and was tedious when come to shifting of folder and other changes), please try using

    =Folder.Files("D:\....................) => put all the csv or txt file in a folder

    add a custom column
    Excel.Workbook([Content])

    Expand the data fields and all the files will be append in one table ( note: all the file must be in same headers and names)

    and next time when you add the 6, 7.8 ...... file to the dedicated folder, you just need to go to the report, right click and refresh to get the desire result


    please try it up, if cannot you can give me a mock files (few of it) and I will do it for you
    Christopher Yap

+ 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. [SOLVED] IMPORTING TEXT FILES TO EXCEL - Multiple Multi-line text files, each in a new column
    By wrenchfry in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 12-23-2014, 08:37 PM
  2. Replies: 0
    Last Post: 11-27-2012, 01:43 PM
  3. [SOLVED] How to automate a 20 step process after importing data into Excel
    By ericinarcata in forum Excel General
    Replies: 1
    Last Post: 11-13-2012, 05:03 PM
  4. How can I automate importing text files into Excel 2010
    By gsander in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 07-03-2012, 10:17 AM
  5. Automate setting View on all Excel files
    By hip21 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 09-28-2011, 03:59 PM
  6. automate importing text files?
    By sinnetBS in forum Excel General
    Replies: 0
    Last Post: 06-22-2006, 06:34 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