Surraya Marvi
Surraya Marvi

Reputation: 131

Import txt file into excel, split string where spaces and place each word in cell

I have a .txt file that contain thousands of words all are separated by spaces. I want to add all those words into an excel spread sheet. each word in a cell so the result would be a large column of words. Following are examples:

myText.txt

Candle Man great Hazard change Length Boring

myExcel.xlsx

------
Candle
------
Man
------
great
------
Hazard
------
change
------
Length
------
Boring
------

Upvotes: 2

Views: 7651

Answers (2)

Wizhi
Wizhi

Reputation: 6549

Maybe you could just use transpose in excel if you only have single words..?

Import your data (either by import or copy and paste)

enter image description here

Then you use "Text to Columns" and choose "Delimited".

enter image description here

The words are separated by space, so we choose space as delimiter, press Finish.

enter image description here

You should now have each word separated by a single cell. Something like this. Copy this range.

enter image description here

Click in cell you want to paste into and choose paste (right click or go to Home-> Paste -> Transpose.

enter image description here

You should now have a result like this:

enter image description here

Upvotes: 3

Tam Le
Tam Le

Reputation: 378

You can use the feature Text to column. Paste the text, select the cell has text. In the ribbon go Data => Text to columns => Delimited => Click Next => Tick Space => Finish. Next time you copy text, Excel will automatically separate them into columns as well. So remember uncheck it if you don't need the functionality anymore. If you want rows then you can copy, paste special transpose the columns.

Upvotes: 0

Related Questions