tags:

views:

24

answers:

1

Hi!

Is it possible to have multiple values under the same field in a .CSV file?

Lets say I have a "email" field on my webpage, and the user may optionally type in multiple addresses. Then I want my .csv file to be able to handle a unknown number of "email" values. How can i achieve this? The .csv is read by a third party program which i cannot modify.

+1  A: 

Yes. You can have multiple values in one filed of a CSV file.

If the multiple values are separated by space you need not do anything special but if the values are separated by a comma, you need to enclose the entire field in double quotes.

Example:

Name,E-mail    
foo,[email protected] foo [email protected]
bar,"[email protected],[email protected]"
codaddict
Ok, so if I have fields: FirstName,Email,Lastname it could be: Mike, [email protected] [email protected] [email protected], Hanson ?
matskn
Great! Thanks alot!
matskn
That looks good. The only thing you need to ensure that if a comma appears in a field, the field must be enclosed in `"..."`
codaddict