+ Reply to Thread
Results 1 to 7 of 7

PowerQuery: Combine TXT files based on multiple deliminators

  1. #1
    Forum Contributor
    Join Date
    04-20-2020
    Location
    New Jersey, NJ
    MS-Off Ver
    MS Office 365
    Posts
    159

    PowerQuery: Combine TXT files based on multiple deliminators

    Hey all!

    I am looking to combine these files "Drive to folder/files" from a folder level. The issue is that when combining i can only select 1 deliminator, either comma or semi-colon. If it was just these 2 files I would change the deliminator in one of the files, there are numerous files and i would prefer not to edit them (even if a script can do it all for me!).

    DAX:

    Please Login or Register  to view this content.

    Any thoughts?

    Thanks in advance!
    Last edited by AliGW; 07-20-2023 at 11:35 AM. Reason: Thread title amended for clarity.

  2. #2
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,838

    Re: Combine TXT files based on multiple deliminators

    Could you attach relevant files to the thread using our attachment facility, please? Include the Excel workbook that you are using to import the files.
    Ali


    Enthusiastic self-taught user of MS Excel who's always learning!
    Don't forget to say "thank you" in your thread to anyone who has offered you help.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    Forum Rules (updated August 2023): please read them here.

  3. #3
    Forum Contributor
    Join Date
    04-20-2020
    Location
    New Jersey, NJ
    MS-Off Ver
    MS Office 365
    Posts
    159

    Re: Combine TXT files based on multiple deliminators

    Certainly.

    PQ Help - July23.xlsx , DailyOpenAM.TXT , DailyOpenAM.TXT
    Last edited by AliGW; 07-20-2023 at 11:35 AM. Reason: Please do NOT quote unnecessarily!

  4. #4
    Forum Expert
    Join Date
    11-24-2013
    Location
    Paris, France
    MS-Off Ver
    Excel 2003 / 2010
    Posts
    9,831

    Arrow Re: PowerQuery: Combine TXT files based on multiple deliminators


    Hello,

    in case there is no way with Power Query it should be easily achieved with a classic VBA procedure
    but as that depends on the missing exact expected result attachment …

  5. #5
    Forum Contributor
    Join Date
    04-20-2020
    Location
    New Jersey, NJ
    MS-Off Ver
    MS Office 365
    Posts
    159

    Re: PowerQuery: Combine TXT files based on multiple deliminators

    Quote Originally Posted by Marc L View Post

    Hello,

    in case there is no way with Power Query it should be easily achieved with a classic VBA procedure
    but as that depends on the missing exact expected result attachment …
    Python it is.

  6. #6
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,838

    Re: PowerQuery: Combine TXT files based on multiple deliminators

    I haven't found a way from within PowerQuery, although that doesn't mean there isn't one.

    Code might be your best option for now.

  7. #7
    Forum Expert rorya's Avatar
    Join Date
    08-13-2008
    Location
    East Sussex, UK
    MS-Off Ver
    365 Ent Monthly Channel / Insiders Beta
    Posts
    8,913

    Re: PowerQuery: Combine TXT files based on multiple deliminators

    You could change your Transform function to something like this:

    Please Login or Register  to view this content.
    so it will attempt to parse using a comma and then if there is no heading in column 2 (because all the data stayed in one column) it will attempt to parse using the semicolon instead. Not sure it will be foolproof - e.g. if one or more of your column headers included a comma - but it seems to work with your samples.
    Rory

+ 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. Read, Extract, Change data stored using multiple deliminators
    By XeRo13g in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 01-15-2020, 07:59 AM
  2. [SOLVED] New to Excel programming. In need of a macro to combine multiple files with multiple tabs.
    By nflores0303 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 04-12-2016, 11:03 AM
  3. Replies: 4
    Last Post: 10-04-2015, 08:21 AM
  4. Excel vba to tel adobe combine two pdf files based on a spcified list of files
    By Abbadon486 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 12-30-2014, 12:04 PM
  5. Replies: 2
    Last Post: 06-17-2014, 11:16 AM
  6. combine multiple files into one
    By Muzbuz in forum Excel General
    Replies: 10
    Last Post: 06-14-2010, 11:52 PM
  7. Multiple Deliminators
    By Fraggs in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 08-04-2005, 09:05 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