Advent of Code is back! Unwrap daily challenges to sharpen your Alteryx skills and earn badges along the way! Learn more now.
Free Trial

Alteryx Connect Discussions

Find answers, ask questions, and share expertise about Alteryx Connect.

Issues in reading .txt file

khushitalwar
5 - Atom

How do we separate the fields for the following .txt file?

As there are uneven spaces, how will alteryx read that this is one field?

1 REPLY 1
shancmiralles
11 - Bolide

whenever I pull the data into the canvas a pop up window will appear called "Resolve File type".  

 

"Read it as a built in type "  : from the drop down option choose Comma Separated Value (*.csv)

 

 

from here you can start using the text to columns tools :TextToCols: to separate the data. 

 

to get your output you can try what i did (just to see if it works)

 

1)  text to columns tools :TextToCols: :

    (configuration: 

      column to split : Field_1

      Delimiters: (space)

     Split to columns

      Number of columns: 3

      Extra characters: Leave extra in the last column)

 

2)   text to columns tools :TextToCols: :

    (configuration: 

      column to split : 3

      Delimiters: (space)

     Split to columns

      Number of columns: 3

      Extra characters: Leave extra in the last column)

 

3) text to columns tools :TextToCols: :

    (configuration: 

      column to split : 33

      Delimiters: (space)

     Split to columns

      Number of columns: 3

      Extra characters: Leave extra in the last column)

 

 

4) Select tool :Select::

  (configuration:  uncheck/deselect fields  "Field_1", "3", "33" (columns))

 

5) Formula tool :formula::

    just reuse/override column "33" (output column) with the following formula:    

         31]+" "+[32]+" "+[331]+" "+[332]      

 

6) Data Cleansing tool :cleansedata::

    select field : 333 only and "Leading and Trailing Whitespace".

 

7) Select tool :Select::

  configuration:  uncheck/deselect fields  "32", "331", "332"

 

 

8) text to columns tools :TextToCols: :

    (configuration: 

      column to split : 333

      Delimiters: (space)

     Split to columns

      Number of columns: 3

      Extra characters: Leave extra in the last column)

 

9) text to columns tools :TextToCols: :

    (configuration: 

      column to split : 3333

      Delimiters: (space)

     Split to columns

      Number of columns: 3

      Extra characters: Leave extra in the last column)

 

10) Select tool :Select::

  configuration:  uncheck/deselect fields  "333", "3332", "3333", "1_2"

 

11) Data Cleansing tool :cleansedata::

    select field : ALL FIELDS  and "Leading and Trailing Whitespace".

 

not sure if it will work from your end , but hopefully it does. 

( i got the tip of reading it csv instead of txt from @mikemc1979  )

 

cheers!