Problem saving Excel as text file

In summary: Since you're using Excel, it's clearly not a huge dataset. So you could just use your favorite text editor to do a search and replace to switch quote-tab and tab-quote to tab...In summary, the program is displaying fields containing a comma in quotes in the exported text file, which is not what I want. I've tried all sorts of cell formats, but the double quotes still appear. There is an easy way to write a macro to remove the quotes, but I'm not sure if it's necessary. The data is being moved into a table in a SQL Server database, and I believe it would be easy to import the data directly into SQL Server using DTS.
  • #1
Doc Al
Mentor
45,569
2,222
I'm trying to save an Excel spreadsheet as a (tab-delimited) text file for input into another database. For some reason, fields containing a comma are being displayed in the text file within quotes, which I don't want. For example:
John Doe appears as: John Doe
Doe, John appears as: "Doe, John"​

What I want to see is:
John Doe appearing as: John Doe
Doe, John appearing as: Doe, John​

Is there any clever way of saving the Excel file so I don't have those quotes?
 
Technology news on Phys.org
  • #2
I believe the quotes will go away if the cell categories (types) are not Text. Select the cells, then choose Format->Cells.

Can you change the cell type from Text to some other value? Like General or Custom?

- Warren
 
  • #3
I've tried all sorts of cell formats, but the double quotes still appear for entries that contain a comma. So that didn't work.

(It's almost like the program is trying to prevent a comma-separated value error. But I'm saving as tab-separated text. Strange!)
 
  • #4
Doc Al said:
I've tried all sorts of cell formats, but the double quotes still appear for entries that contain a comma. So that didn't work.

(It's almost like the program is trying to prevent a comma-separated value error. But I'm saving as tab-separated text. Strange!)

Since you're using Excel, it's clearly not a huge dataset. So you could just use your favorite text editor to do a search and replace to switch quote-tab and tab-quote to tab...

What I personally find obnoxious is that it doesn't quote the other stuff. If it did all or none, it would be a whole lot easier to deal with.
 
  • #5
NateTG said:
Since you're using Excel, it's clearly not a huge dataset.
About 15K records. Don't ask. :uhh:
So you could just use your favorite text editor to do a search and replace to switch quote-tab and tab-quote to tab...
Editing the output, while easy enough, would be my last choice. Good idea, though. (It's just bugging me that I can't turn that stuff off!) But I think I've found how to write a macro that removes the quotes.
 
  • #6
Doc Al said:
About 15K records. Don't ask. :uhh:

Editing the output, while easy enough, would be my last choice. Good idea, though. (It's just bugging me that I can't turn that stuff off!) But I think I've found how to write a macro that removes the quotes.

I know it's ugly, but unless you're going to be doing this sort of thing regularly, the effort in finding the 'nice' answer isn't going to save you any time.
 
  • #7
Which database system are you moving it into? I usually work with SQL Server and Access so I can just easily import data directly from Excel. I used to have to move around a lot of data, and even if my final format needed to be a delimited text file, I often pulled the data into a database system first, creating a table, and then did the export to text file from there. It gave me a chance to check and clean the data, and also better control of the export process.
 
  • #8
The Excel data is being moved into a SQL Server table. That's its final destination, for use by another program. (Is there an easy way to move the data directly into SQL Server?)
 
  • #9
Yes, it's super easy. You can use DTS (Data Transformation Services) in Enterprise Manager. Have you tried out the DTS import wizard?

Here's how you can quickly move an Excel spreadsheet into a new table. In Enterprise Manager, select your database, and then right click and you should see an option for All Tasks and then Import Data. That will bring up the Wizard. Hit next and then make sure you choose Excel for your data source. Then browse to the file you want to import.

Then you hit next and you'll see all the destination info, probably won't need to change anything here, just double check that the target database is correct. Hit next and you'll see an option to just simply copy everything over or you can construct a SQL Query for the transfer.Then hit next and you should get a choice for which worksheets to import. After you have chosen a worksheet, you can edit the name in the path in that destination column to be whatever name you want the new table to have. Hit Next, choose "run immediately" and hit next, check everything over and hit finish.. babdaboom-badabing! You should get a message that it was successful. Refresh Enterprise Manager and you should see your table.
 
Last edited:
  • #10
What version are you using? My Danish 2002 sp3 have no problem exporting as a tab-delimited text file, where Doe, John appears without quotes as needed.
 
  • #11
Math Is Hard said:
Yes, it's super easy. You can use DTS (Data Transformation Services) in Enterprise Manager. Have you tried out the DTS import wizard?
Thanks! I'll check it out.
 

1. Why can't I save my Excel file as a text file?

There could be several reasons why you are unable to save your Excel file as a text file. One possible reason could be that your Excel file contains formatting or formulas that are not compatible with a text file. Another reason could be that your Excel software is outdated and does not support saving as a text file.

2. How do I save my Excel file as a text file?

To save your Excel file as a text file, you can go to the "File" menu and select "Save As". Then, choose "Text (Tab delimited)" or "CSV (Comma delimited)" as the file type. You can also use the "Save As" shortcut by pressing "Ctrl + Shift + S".

3. What is the difference between a text file and an Excel file?

A text file is a basic file format that only contains plain text, while an Excel file is a spreadsheet document that can contain text, numbers, formulas, and formatting. Excel files are typically used for data analysis and organization, while text files are more commonly used for storing and transferring raw data.

4. Can I convert a text file to an Excel file?

Yes, you can convert a text file to an Excel file by opening the text file in Excel and using the "Text to Columns" feature. This will allow you to separate the text into columns and format it as a spreadsheet. You can also copy and paste the text data into a blank Excel sheet and then format it as needed.

5. How can I troubleshoot issues with saving Excel as a text file?

If you are experiencing issues with saving Excel as a text file, you can try the following troubleshooting steps: 1) Check if your Excel file contains any formatting or formulas that may not be compatible with a text file. 2) Make sure your Excel software is up to date. 3) Try closing and reopening Excel. 4) Save the Excel file as a different file type, such as CSV or XML, and then try converting it to a text file. 5) If all else fails, you can try using a third-party file conversion tool to convert your Excel file to a text file.

Similar threads

  • Programming and Computer Science
2
Replies
65
Views
2K
  • Programming and Computer Science
Replies
22
Views
919
  • Computing and Technology
Replies
3
Views
2K
  • Computing and Technology
Replies
20
Views
691
  • Programming and Computer Science
Replies
1
Views
1K
  • Programming and Computer Science
Replies
5
Views
1K
  • Programming and Computer Science
Replies
4
Views
8K
  • Programming and Computer Science
Replies
4
Views
17K
  • Programming and Computer Science
3
Replies
75
Views
4K
  • Programming and Computer Science
Replies
1
Views
2K
Back
Top