Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I open space-delimited file in Microsoft Excel?

When i try to open space delimited file in excel, the whole content opens in a single column. Is there any way to open the space delimited file in excel so that the delimited contents are properly formatted into different columns?

My scenario is that i have a file that needs the delimiter to be some thing like '" ' (A inverted command followed by a space), because my file format is like this:

"First Name" "Gender" "Phone" 
"Tom Jones" "M" "123-123-1234"
like image 728
merazuu Avatar asked Feb 13 '14 16:02

merazuu


People also ask

How do I open a CSV file in Excel using delimiter?

To open a comma-delimited (CSV) file properly, use Excel's Data Import from Text feature to open the import wizard and set all columns as text. If you click the file and allow Excel to open it automatically, the columns might be formatted improperly.

How do you convert space Delimited to comma delimited?

The most straightforward way to convert a space-delimited to a comma-separated (CSV) file in Python is to replace each empty space ' ' with a comma ',' character using the string. replace() method. This works if two values are separated by exactly one empty space.


3 Answers

I think you can specify the string quotation mark(', " or none) in the wizard, in the same step where you specify the delimiter.

  1. Open the CSV file with Excel 2016.
  2. Look for "Data" tab and "Text in column" button.
  3. In the step 1, select "Delimited".
  4. In the step 2, select first "space", and then choose "string classifier" as ". Then Excel will recognise the string quoted in " " and separate in columns the data with space.
  5. Change format in step 3. "Finish".

Note: be sure that all the delimiter is one space; several spaces will be divided into several columns. To avoid that, please preprocess the csv file with a text editor. Sublime Text/Notepad++ will do. To make is more clear, I always substitute the delimiter with ;.

Replace multiple (more than one) spaces with ;: find \s\s* and replace with ;. Change by need.

like image 54
WesternGun Avatar answered Nov 16 '22 00:11

WesternGun


Use the standard "Open" command. Then go to "Text Import Wizard" and choose that the original data type was delimited. You may need to go to a different step of the Wizard to specify that the delimiter is a space, but the Wizard does include the option of specifying what character the delimiter is.

like image 32
La-comadreja Avatar answered Nov 15 '22 22:11

La-comadreja


On the Data tab click on From Text in the Get External Data section.

Tell the Wizard to use the space as the delimiter.

like image 38
Gary's Student Avatar answered Nov 15 '22 23:11

Gary's Student