Saving an Excel work sheet as text

I’m trying to manipulate data in a txt file (*.cfg) in Excel and then save it as pure text. I’m having problems using “save as” from Excel because it insists on puting some of the text in quotes “”. Here is an example:

Original text



[GeneralEngineData]
engine_type=5
Engine.0=0.4, -2.5, 0.3 // was -1
Engine.1=0.4 , 2.5, 0.3 
Engine.2=0.4, -2.5, 0.3 
Engine.3=0.4 , 2.5, 0.3 
fuel_flow_scalar=1.203 // was 0.987, 1.122
min_throttle_limit=-0.299927

Text saved from Excel



[GeneralEngineData]
engine_type=5
"Engine.0=0.4, -2.5, 0.3 // was -1"
"Engine.1=0.4 , 2.5, 0.3 "
"Engine.2=0.4, -2.5, 0.3 "
"Engine.3=0.4 , 2.5, 0.3 "
"fuel_flow_scalar=1.203 // was 0.987, 1.122"
min_throttle_limit=-0.299927

This was done without doing any manipulation of the data at all, no “text to columns” or anything.

Any ideas on how to do this properly?

Copy it and paste it in notepad.

Thanks, I was trying to avoid copy/paste because I will eventually want to use a macro to do this, is it possible to get a macro to copy/paste into another program?

Could you just have a macro to select all then copy so that all you have to do is ctrl-v to paste it in Notepad?

At the moment it is probably just as easy to click on the top left square and then CTRL+C.

Usually saving it as either a CSV or TXT file works. CSV is really just a text file where each cell is separated by a comma (Comma Separated Values)

It doesn’t work in this case. That is the nature of the problem. Excel is storing each cell in the .txt file, separating cells in the same row with a comma. When the text in a cell contains a comma, Excel must enclose the cell in quotes to ensure that any program reading the data will also interpret it as a single cell, rather than two cells separated by the comma.

You cannot write a macro that will copy then paste into an application that does not support VBA (you could copy and paste into Word with a single macro, for example, but not into Notepad).

When I see people having trouble with something like this I usually go back to the beginning. Why are you manipulating this data in Excel? What are you doing to it? From what is shown in the OP it looks like you are not treating the data as numbers in separate cells, but as lines of text. Excel might not be the best solution.

Can I fix this by using TAB separated and making sure there are no tabs in the text? Edit: Apparently not as there don’t appear to be any tabs but the problem still occurs in tab separated .txt.

A good idea.

I’m trying to make a spreadsheet that can edit the aircraft configuration files from Microsoft Flightsim 2004. Specifically I want to be able to tell it how many passengers and cargo I want on my aeroplane. There is a small amount of data manipulation, no more complicated than simple arithmetic and multiplication. I’d like it to use Excel, because I’d like to have it in the same workbook as my fuel calculations.

I have no problems with any of it except for saving it. At the moment I’ve taken don’t ask’s suggestion and am just copy/pasting.

I am aware that FS2004 already has a facility for doing this but I’d like to intergrate it into other things such as fuel planning etc.

If it’s just the text you want, try printing it to a file. You’ll need to install a Generic Text-only printer

That would be almost perfect except it ends up with lots of these "" which seems to “break” the file. Any ideas on what would cause those? I tried copying some into this post but they came out as line breaks.

Edit: the symbol that should’ve been in the quotes is a square character that you sometimes see when you don’t have the correct font installed.

It seems that the text printer driver is adding line breaks (probably not a problem) and also cutting off text (problem.) Text print drivers that appear to work properly are quite expensive!

Try saving as “Formatted Text (space delimited) (*.prn)”, which will give you a text file you can open in notepad.

I think that worked. It doesn’t have any errors I can see anyway.

That worked well thanks. I’ve now set up a macro to do this with the press of a button!

P.S. I’ve got it saving directly as a *.cfg so I don’t even need to open it in note pad.