Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes! Register now.

Reply
RokuCap
Helper I
Helper I

Splitting Columns by Tab Delimiter for Variable Tab Sizes in a Text File

I have a text file that has text separated by different tab lengths (Refer to the example below). I want to clean up the data by separating each grouped string into their own columns. In the example, the tab length between A and A Description, A Description and A Category is the same for all rows (A1-A6, B1). Some rows have an additional field between the Description and Category, also with consistent tab size on both sides between the Description and Category fields.

 

What I've tried to do:

 

1. Create a Source query that imports the text file. Reference this query in the next step.

2. Used the Split Column by Delimiter Function, copying the tab size between each field in the preview into the custom delimiter. Function below:

 

=Table.SplitColumn(Source, Column 1, Splitter.SplitTextByEachDelimiter({"#(tab)#(tab)#(tab)#(tab)#(tab)#(tab)#(tab)#(tab)#(tab)#(tab)#(tab)#(tab)"},QuoteStyle.Csv,false){"Column1.1","Column1.2"})

 

3. Repeated Step 2 with different tab sizes to split remaining fields.

 

Question: Is there a more intuitive way of doing this? Is this the recommended route (to delimit by tab size)? It assumes the tab sizes between fields are the same in the source text file but I'd like to be able to future proof it in the case a text file has different tab sizes to the original text file used to develop the query.

 

Example (with generic data):

RokuCap_0-1655170563885.png

 

Tranform into:

RokuCap_1-1655170679078.png

 

 

 

1 REPLY 1
Daryl-Lynch-Bzy
Resident Rockstar
Resident Rockstar

Hi @RokuCap - it would be nice to have a sample file to play with.  Could you upload one?  

Otherwise this is what I am thinking.  I would keep the rows in 1 column.  I would apply a Trim function to align the A and B to left.  I might try the following function, Splitter.SplitTextByCharacterTransition - PowerQuery M | Microsoft Docs.  The idea here is to find the transition from Character to Tab.  Another Option it to split for column1 and remainder, then split column2 and remainder, and column 3 and remainder etc...  Another option is to split the rows into group A and group B, then split each group according then Append (Table.Combine) back together again.

I hope this helps you think of some different approaches.

Helpful resources

Announcements
September Power BI Update Carousel

Power BI Monthly Update - September 2025

Check out the September 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.