Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

how to put each item of csv file in a separate cell? 1

Status
Not open for further replies.

wvdba

IS-IT--Management
Jun 3, 2008
465
US
Hi,
i am creating a .cvs file from values of some fields in a database separated by semicolon (;).
the file is created, but all the data in a line is crammed into one cell instead multiple cells. is there anyway to put each item that is separated by (;) into a separate cell?

john;doe;123 elm street;anytown;tx;87444

all this data is going into one cell
i like each item to be in a single cell

thanks much.

 
csv" stands for "comma separated values", and your values are not separated by commas.

From Excel 2003, you could go to Data > Import External Data > Import Data, and this will start a wizard that lets you define the delimiter you are using (semicolon in this case).

If you are looking for a solution involving vbscript, you should post the code you have and explain where you are stuck.
 
If you can't intervene and create a proper CSV file, you could post-process your output file to change it to a csv.
Consider using DOS edlin editor for this.

Create a file say csv.ed that contains the
following 2 lines:

1,#r;^Z'
e

The ^z is the CTRL-Z character not 2 separate characters. Next just type this in

edlin mycsv.csv <csv.ed


In order to understand recursion, you must first understand recursion.
 
No need to go to all the trouble. Change the file name extension to .TXT and then open it in Excel.

Excel will offer you an import prompt where you can select/define your delimter...which is ;

The file will then be opened and each value will be in it's own cell

-- Jason
"It's Just Ones and Zeros
 
thanks everybody.
comma did it. once i put the commas, it put each item in a separate cell.
p.s. this process has to be automatic. after the file is created, it will be emailed. so, putting it in a text file and "processing" it is not the purpose. .csv files opens with excel.
cheers.
 


wvdba,

Take the sheet that has everything in column A

Select Column A

Data > Text to columns - DELIMITED

Check the SEMICOLON box

Make sure each field is the proper column type.

Skip,

[glasses]Just traded in my old subtlety...
for a NUANCE![tongue]
 
thanks skip.
i got it working now. i just used commas between the values to create a .csv file. the email sends it to the recipient and when he opens it, it opens with excel. thanks so much everyone.
cheers.
 



Opening a .csv in Excel can bite you in certain corcumstances. Excel makes some assumptions about some numeric data that you may not necessarily want. Just be aware.

Using Data > Import, or using the Data > Text to columns for data already in your sheet, may work better if stuff shows up different that you thought it might.

Skip,

[glasses]Just traded in my old subtlety...
for a NUANCE![tongue]
 
thanks skip.
all my data is alphanumeric - no pure numbers. it seems that it's working ok. but how do i get a .csv file to open with what?
thanks.
 


Data > Import rather than OPEN.

Skip,

[glasses]Just traded in my old subtlety...
for a NUANCE![tongue]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top