Magic numbers in Excel waste my time

One of the tools I created recently output its data in CSV format. The Python CSV library is quite nice. However, opening the file in Excel gave the error “SYLK: file format is not valid” or “Excel has detected that ‘test.csv’ is a SYLK file, but cannot load it.” OpenOffice handled the file just fine.

It turns out that a CSV file with the first two bytes set to “ID” (case-sensitive) is detected as a different file format by Excel. And this is why I hate software.

Excel has detected that 'test.csv' is a SYLK file, but
cannot load it.

5 thoughts on “Magic numbers in Excel waste my time

  1. I have been bitten by this same idiotic bug in the past. And this is why I hate Microsoft, but love Google.

  2. Just tried it, and if you just click through the dialog, it actually opens just fine (after complaining), at least with Office 2010. It is a silly bug to have, and it seems like you should be able to force it to be opened as CSV or at least text. I’ll pass it along to the Excel team. Trying to support most of the file formats that users have used over the last 20+ years can get tricky sometimes.

    BTW, good seeing you at BlackHat –

  3. If you put quotes around your header field, excel seems to behave in the expected way. But I think this will not make anybody love ms more. I have been through this. :(

  4. One programmer’s oversight is reason to hate an entire company now? Makes me afraid to be a software developer.

Comments are closed.