Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I'm using Numbers on my Mac at the moment and exporting to a CSV file. Is there a way to enclose every value with ""?

For example I'm getting the csv file like this:

1,2,3,4,5,6,7,8,9

When I want it like this:

"1", "2", "3", "4", "5", "6", "7", "8", "9"

I've tried doing this in Excel for mac too but haven't had much luck.

Thanks

share|improve this question
add comment

4 Answers 4

up vote 3 down vote accepted

In Excel, you can use CONCATENATE() function to enclose values with double quotation marks. Let's say your values are ranged from A1 to A9.

Set cell B1 as ".

Now you can enter the following formula in cell C1:

=CONCATENATE($B$1,A1,$B$1)

When you drag that cell till C9, you'll have all your values enclosed with double quotation marks. Then you can save your worksheet as a CSV file.

PS: Using =CONCATENATE(""",A1,""") does not work here.

share|improve this answer
    
Nice thanks, felt a bit hacky but did the job –  ing0 Jun 28 '10 at 11:58
    
You can use =CONCATENATE("""",A1,"""") - (4 x ") - still hacky but more simple. –  Mike Fitzpatrick Jun 28 '10 at 13:16
add comment

For Excel, you can use Earl Kiosterud's Text Write program:

The Text Write Program is a Microsoft Excel workbook with a macro program that writes any sheet of any open workbook to a text file with lots of options.

Theses options are:

File Name to write
Record Delimiter:     Code/Character  13,10
Stop if Record Delimiter found in cell?:  Yes
Field Delimiter:  Code/Character  , (comma)
Bracketing Code/Character (text qualifier):   " (quotation mark)
Bracket data fields?:     Yes
  Bracket blank fields also?:     No
Skip blank rows?:     No
Write entire sheet?:  Yes
     If no, Expand selection?:    No
     If no, write rectangular?:   No
share|improve this answer
2  
Thanks however this uses VBA which isn't compatible with Excel for mac :( –  ing0 Jun 28 '10 at 11:50
add comment

Well, you can use replace function of a lot of programs (I recommend MS Word or Notepad++ because yoy can replace also special characters like carrier return).

In that case, you can simply replace all ocurrences of

,

with

","

And finally putting " in the beginning and the end of text.

share|improve this answer
add comment

if you require quotes then chances are you have commas in the fields which is why you are enclosing them in quotes. Doing a Replace on all , with "," will pretty much mess up your format. You are better off exporting with a different delimiter (something that really will not appear in your data - maybe a special character) and then doing your Replace on that

share|improve this answer
    
Thanks but the ticked answer above seems to work fine! –  ing0 Feb 3 '13 at 12:38
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.