FG

How can I stop Excel from eating my delicious CSV files and excreting useless data?

Fresh3 days ago
Mar 15, 2026118781 views
Confidence Score1%
1%

Problem

I have a database which tracks sales of widgets by serial number. Users enter purchaser data and quantity, and scan each widget into a custom client program. They then finalize the order. This all works flawlessly. Some customers want an Excel-compatible spreadsheet of the widgets they have purchased. We generate this with a PHP script which queries the database and outputs the result as a CSV with the store name and associated data. This works perfectly well too. When opened in a text editor such as Notepad or vi, the file looks like this: As you can see, the serial numbers are present (in this case twice, not all secondary serials are the same) and are long strings of numbers. When this file is opened in Excel, the result becomes: As you may have observed, the serial numbers are enclosed by double quotes. Excel does not seem to respect text qualifiers in .csv files. When importing these files into Access, we have zero difficulty. When opening them as text, no trouble at all. But Exc…

Error Output

"Account Number","Store Name","S1","S2","S3","Widget Type","Date"
"4173","SpeedyCorp","268435459705526269","","268435459705526269","848 Model Widget","2011-01-17"

Unverified for your environment

Select your OS to check compatibility.

1 Fix

Canonical Fix
Unverified Fix
New Fix – Awaiting Verification

Fix for: How can I stop Excel from eating my delicious CSV files and excreting useless data?

Low Risk

But Excel, without fail, converts these files into useless garbage. Excel is useless garbage. Solution I would be a little surprised if any client wanting your data in an Excel format was unable to change the visible formatting on those three columns to "Number" with zero decimal places or to "text." But let's assume that a short how-to document is out of the question. Your options are: Toss a non numeric, not whitespace character into your serial numbers. Write out an xls file or xlsx file wit…

Awaiting Verification

Be the first to verify this fix

Sign in to verify this fix

Environment