0

I want to obtain a simple CSV file that looks like this:

Filename,Value1,Value2
filename1.ext,0.38,0.44
filename2.ext,0.60,0.50
...

However, -unfortunately- some of my filenames start with = and that messes up the content in Excel, so those lines (well, cells) are replaced with #NAME?. So how can I prevent Excel to modify any of the content while saving as .csv?

P.S.: I'm actually obtaining the *.csv files programmatically, but then I need to replace some columns across files, so I -kind of- need to use Excel.

Edit

I tried the solutions here, but in that case Excel actually removes the = sign in the beginning, hence modifying the content.. It seems like I'm going to quit doing this but I still wonder if there is a solution for this. Thanks,

2
  • 1
    csv files are plain text files. You don't need to use excel to manipulate them - most scripting languages will do the job ...
    – DavidPostill
    Commented Jul 8, 2016 at 13:21
  • Well yeah, I was trying to save time but I guess it would be faster to program it :) Thanks..
    – jeff
    Commented Jul 8, 2016 at 13:22

2 Answers 2

2

You can format the cells as text so it wont interpret the = sign.

You can use ' to escape the = sign.

Or, as you already obtain your *.csv programmatically, you could script it with a scripting language of your choice. CSV are just plain text files that are associated with MS Excel by default.

0

The best and most general solution is to encapsulate all texts in the CSV with " (double quotes). That works in Excel, and most other tools with understand that too.

You must log in to answer this question.

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