4

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

4 Answers 4

4

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.

1
  • You can use =CONCATENATE("""",A1,"""") - (4 x ") - still hacky but more simple. Jun 28, 2010 at 13:16
1

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
1
  • 2
    Thanks however this uses VBA which isn't compatible with Excel for mac :(
    – ingh.am
    Jun 28, 2010 at 11:50
0

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.

0

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

1
  • Thanks but the ticked answer above seems to work fine!
    – ingh.am
    Feb 3, 2013 at 12:38

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .