rdist

August 2, 2010

Magic numbers in Excel waste my time

Filed under: Software engineering,Windows — Nate Lawson @ 8:00 am

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 Comments

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

    Comment by EC — August 2, 2010 @ 8:46 am

  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 –

    Comment by David LeBlanc — August 2, 2010 @ 3:06 pm

    • Thanks, that’s very kind of you. I’m sure I’m not the first to complain.

      Good to see you too. Sorry we were in such a hurry.

      Comment by Nate Lawson — August 3, 2010 @ 1:32 pm

  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. :(

    Comment by biswanath — August 3, 2010 @ 12:00 am

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

    Comment by RandomInsano — August 7, 2010 @ 2:35 pm


RSS feed for comments on this post.

Blog at WordPress.com.