1

Opening a sample CSV file in notepad shows the format as:

"ds","y"
"2007-12-10",9.59076113897809
"2007-12-11",8.51959031601596
"2007-12-12",8.18367658262066
"2007-12-13",8.07246736935477
"2007-12-14",7.8935720735049
"2007-12-15",7.78364059622125
"2007-12-16",8.41405243249672
"2007-12-17",8.82922635473185
"2007-12-18",8.38251828808963
"2007-12-19",8.06965530688617
"2007-12-20",7.87929148508227
"2007-12-21",7.76174498465891
"2007-12-22",7.52940645783701
"2007-12-23",8.38526052015541
"2007-12-24",8.62011072542292

When opening the file using Excel and then saving the file, it saves as the following (file format CSV [comma delimited]).

This is what it looks like in notepad:

"ds,""y"""
2007-12-10,9.59076113897809
2007-12-11,8.51959031601596
2007-12-12,8.18367658262066
2007-12-13,8.07246736935477
2007-12-14,7.8935720735049
2007-12-15,7.78364059622125
2007-12-16,8.41405243249672
2007-12-17,8.82922635473185
2007-12-18,8.38251828808963
2007-12-19,8.06965530688617
2007-12-20,7.87929148508227
2007-12-21,7.76174498465891
2007-12-22,7.52940645783701
2007-12-23,8.38526052015541
2007-12-24,8.62011072542292

How do I save the opened file while keeping the original format?

  • Putting something in a double quotes makes excel interpret it as text. When using 2x double quotes excel treats the first as an escape character. – angelofdev Oct 9 '18 at 0:01
  • 1
    I don't think you're going to be able to keep the original format. Excel exports the file using its CSV engine, which will put quotes around some values, but values it knows will not need to be escaped will not have quotes, as you can see from your results. – heavyd Oct 9 '18 at 3:15
  • The best way to preserve the file format seems to be the export using your own VBA procedure. – Akina Oct 9 '18 at 4:58
  • Try this .. select all (in notepad), copy > (in excel) Data,Text2Columns > Delimed, next > Delimiters : comma, next > @ColumnDataFormat, select text for all columns. – p._phidot_ Oct 11 '18 at 7:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.