Import text file

Copper Contributor

Hi all,

My Office 365 has recently updated with the new wizard for importing data. I work with a number of text files which I import into excel using the Text Import Wizard. I would insert Fixed width columns and manually create column breaks as the data does not suit the delimited option, this has worked sufficiently for me.

 

I am aware that the old wizard can still be used to do this but I am wondering if there is a way to do this using the new wizard?

8 Replies

Hi Ross,

 

In File->Options->Data enable "From Text (legacy)" wizard and after that you may use it from Ribbon menu Data section

Get Data->Legacy wizards.

 

And yes, you may use new wizard, it's much more powerful. Check Power Query or Get & Transform for more details.

Hi Sergei,

Thank you for the response, however I am wondering whether the same functionality is available in the new wizard. I have already enabled the legacy wizard but thought I could have missed something with the new wizard.

Ross, in new wizard instead of click on Load after you connected the file use Edit. You'll be in Query Editor. In the Ribbon of the tool find Split Columns and here By Number of Characters.

 

You may choose form options to split on two columns or repeatedly by fixed width. If you have different widths you may split sequentially each next column or after first step in formula bar for this step modify it manually like

 

= Table.SplitColumn(Source, "Column1", Splitter.SplitTextByPositions({0, 5, 10, 12}, false), {"Column1.1", "Column1.2", "Column1.3", "Column1.4"})

expanding the list of positions where to split and adding columns name.

 

Setting the columns by mouse clicks like in legacy wizard doesn't work here.

 

 

Thank you, that works perfectly for the files I know the column breaks for.

For the files I don't know, which have different widths, is there a way to easily identify the number of characters other than manually counting them? The lack of a ruler/indicator makes the process quite time consuming.

Ross, if you have some logic of how to split (e.g. based on width of the first three words in the column before the space, whatever) i guess it'll be possible to formalize it and automate. Query itself knows nothing about that logic, you have to define it somehow.

 

Depends on how complex is the logic, perhaps it could be possible to define query steps just from user interface; or some coding will be required. 

A way to replicate the legacy wizard is to import the text file using the new wizard and formatting it to just one column, then use the Text to Columns feature to insert column breaks using mouse clicks.

Hi Ross,

 

Yes, Text to Column actually uses the same engine as legacy wizard, just another entry into the it. 

Thanks @Sergei