ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   How do I output csv files from Excel with quotes round text fields (https://www.excelbanter.com/excel-discussion-misc-queries/108860-how-do-i-output-csv-files-excel-quotes-round-text-fields.html)

DickG

How do I output csv files from Excel with quotes round text fields
 
Example:
A1 = 123, B1 = XYZ, C1 = 0, D1 = THISISTEXT

Saving as csv will generate
123,XYZ,0,THISISTEXT

I want to output
123,"XYZ",0,"THISISTEXT"

Dave Peterson

How do I output csv files from Excel with quotes round text fields
 
Excel likes to do what it wants. If it thinks you don't need the qualifier, it
won't put them in.

Maybe you could write your own exporting program that would behave exactly the
way you want:

Here are three sites that you could steal some code from:

Chip Pearson's:
http://www.cpearson.com/excel/imptext.htm

J.E. McGimpsey's:
http://www.mcgimpsey.com/excel/textfiles.html

(or maybe you could build your own formula that concatenates the cells using a
giant formula and copy|paste into Notepad.)

DickG wrote:

Example:
A1 = 123, B1 = XYZ, C1 = 0, D1 = THISISTEXT

Saving as csv will generate
123,XYZ,0,THISISTEXT

I want to output
123,"XYZ",0,"THISISTEXT"


--

Dave Peterson

Dave Peterson

How do I output csv files from Excel with quotes round text fields
 
If you're new to macros, you may want to read David McRitchie's intro at:
http://www.mvps.org/dmcritchie/excel/getstarted.htm

DickG wrote:

Example:
A1 = 123, B1 = XYZ, C1 = 0, D1 = THISISTEXT

Saving as csv will generate
123,XYZ,0,THISISTEXT

I want to output
123,"XYZ",0,"THISISTEXT"


--

Dave Peterson


All times are GMT +1. The time now is 08:52 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com