Splitting Data from a Text file into Columns using Power Query

jbragg6625

New Member
Joined
Dec 3, 2015
Messages
5
Hello,

I am having trouble splitting the data I have in a Text file into separate columns in power query. The columns in the text file are separated by a series of five spaces instead of a tab. This means that the normal method of using split comma with the delimiter does not work.

The character length of the data in each column is variable. Also the text file is automatically put into the folder in the current format and have no way of changing that.

Is there some way that I would be able to split the data into separate columns?
 

Excel Facts

Does the VLOOKUP table have to be sorted?
No! when you are using an exact match, the VLOOKUP table can be in any order. Best-selling items at the top is actually the best.
Can't you use ctrl-h to replace five spaces with another delimiter? Or the trim function then split by space?
 
Upvote 0
maybe split column by delimiter....custom....enter 5 spaces....at each occurrence

actually it might be easier to use replace values....value to find would be 5 spaces....replace with would be 1 space then split column by delimiter....space....at left most....click ok
 
Last edited:
Upvote 0
maybe split column by delimiter....custom....enter 5 spaces....at each occurrence

actually it might be easier to use replace values....value to find would be 5 spaces....replace with would be 1 space then split column by delimiter....space....at left most....click ok

I will try the replace values idea but replace it with a comma instead. I can't believe I didn't think of that myself.

Thank you for the help.
 
Upvote 0
Hi
It is an example text
Code:
1     text N1     12345.33     10/15/2014
2     text N3     456     10/19/2014
3     text A7     78965126     10/22/2014
It is a power query code for splitting it to columns
Code:
let
    source = Table.FromColumns({Lines.FromBinary(File.Contents("d:\Path\FileName.txt"), null, null, 1252)}),
    customSplitter = Splitter.SplitTextByDelimiter("     ", QuoteStyle.None),
    return = Table.SplitColumn(source, "Column1", customSplitter, {"Id", "Company", "Amount", "Date"})
in
    return
Regards,
 
Upvote 0

Forum statistics

Threads
1,223,228
Messages
6,170,871
Members
452,363
Latest member
merico17

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top