Solved

saving excel 2007 as text file

Posted on 2011-09-20
9
176 Views
Last Modified: 2012-08-13
Hi Experts

I am trying to save a column of numbers enclosed by single quotes and delimited by a comma as a text file. But when I try to do it, each cell is enclosed by double quotes.

So in excel I see this:

'001232',
'003232',
'787201'

and when I view the text file that I have exported I see this:

"'001232',"
"'003232',"
"'787201'"

Does anyone know how I can save cells as a text file - without the extra double quotation marks?

Thanks
0
Comment
Question by:stummj
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 3
  • 2
  • +1
9 Comments
 
LVL 3

Accepted Solution

by:
dahesi earned 500 total points
ID: 36565851
maybe this workaround will help:

search & replace >"< with >< nothing (via notepad).
0
 

Author Comment

by:stummj
ID: 36565878
That was an obvious workaround that I missed! Trying to overengineer this!! Thank you. I'll keep this open in case anyone knows how to do it properly but I will reward you with points before I close the question. Thanks
0
 
LVL 5

Expert Comment

by:DerZauberer
ID: 36565891
Hmm strage. I tried to reproduce, but i get text without double quotes, no matter what output type i choose ...
What is your Cell format like is it "Text"?
What exact formula is shown for your cells?
Is it like this >''001232',< starting with two double quotes?
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 50
ID: 36566052
Hello,

the data sample that you show above contains the comma within the cell.

'001232',
'003232',
'787201'

If you export that data to a text file, Excel will add double quotes around each cell value that contains a comma, in order to distinguish the comma that is part of the data from the comma that separates the fields in a comma separated file.

Does that make sense?

If you want to avoid the double quotes in the text file, you will need to remove the commas from the cells before saving as text file.

cheers, teylyn
0
 

Author Comment

by:stummj
ID: 36566315
That makes perfect sense teyln - except I'm saving as dos text, so I was expecting like for like. I wasnt saving as a csv. If I remove the comma, Im breaking the integrity of the data, as the data itself needs a comma within the string.
0
 
LVL 50
ID: 36566326
If you need the comma in the data, then you will have to live with the double quotes upon export to txt. The Search and Replace from the first comment seems like the best workaround in that situation.

cheers, teylyn
0
 
LVL 5

Expert Comment

by:DerZauberer
ID: 36587009
Can you try if you still get the double quotes if you save using a macro like this:

ActiveWorkbook.SaveAs Filename:="D:\TEMP\exceltest.txt", FileFormat:= xlTextMSDOS, CreateBackup:=False

Open in new window

0
 
LVL 50
ID: 36590655
Yes, if you export to DOS txt format, the same thing will happen to cells that have commas in the text.

As a workaround, you could copy and paste the cells into a Word document (as unformatted text), then save the Word document as a Plain Text file. Or copy and paste into Notepad or plain text editor.

cheers, teylyn

0
 

Author Closing Comment

by:stummj
ID: 36715135
Thank you very much. Not pretty but a very useable workaround.
0

Featured Post

Salesforce Has Never Been Easier

Improve and reinforce salesforce training & adoption using WalkMe's digital adoption platform. Start saving on costly employee training by creating fast intuitive Walk-Thrus for Salesforce. Claim your Free Account Now

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This tutorial explains how to create a series of drop-down lists that are dependent upon prior selections to guide (“force”) the user to make the correct selection and reduce data errors within Microsoft Excel. Excel 2010 was used for this tutorial;…
Do you use a spreadsheet like Microsoft's Excel?  Have you ever wanted to link out to a non excel file on your computer or network drive?  This is the way I found to do it!
The viewer will learn how to use a discrete random variable to simulate the return on an investment over a period of years, create a Monte Carlo simulation using the discrete random variable, and create a graph to represent the possible returns over…
The viewer will learn how to create two correlated normally distributed random variables in Excel, use a normal distribution to simulate the return on different levels of investment in each of the two funds over a period of ten years, and, create a …

734 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question