OK, getting back to that matter of editing a load of posts to change from Gallery 2 to WordPress galleries[1]. To find all the posts that might have a bit of WPG2 linkage in them, I used phpMyAdmin to give me a list:
SELECT `ID` , `post_title`
FROM `wp_posts`
WHERE `post_content` LIKE "%wpg2%"
I then saved this as a CSV file so I could open it in Excel. Excel happily opened it, and let me save a copy on my desktop. A little later, I tried to open it, and got this friendly message:

Err, what?
Thinking that I might have inadvertently done something weird, I went back to the original downloaded file, which opened as expected. I saved that again, and tried to open the saved copy, and again got the same result. Hmmm. Time to search. I popped the error message into Google[2], and found a Microsoft support article which confirmed that this was a problem with Excel. It even had a link to an Excel for Mac version of the article. Both date back to the last century[3]. It seems that even if Excel itself happily saves a file in CSV format, if it has ID as the first characters in the file[4], it will decide that it’s a SYLK[5] file, which is a format used for data interchange, and which I’d never heard of before. And as the bit after the ID isn’t consistent with it being an actual SYLK file, it refuses to open it. The article suggests a work around: if those first two characters are id, Excel won’t get confused. Sure enough, opening the file with TextWrangler and making that small change was all it took.
All of which made me wonder why the original file worked. Opening that with TextWrangler confirmed my suspicion. Unlike the version Excel saved, it was a properly formatted CSV file with quotes delimiting the fields. So the first two characters were “I rather than ID, and Excel was happy to open it.
Oh, and the Microsoft article tells me:
Microsoft has confirmed that this is a problem in the Microsoft products that are listed in the “Applies to” section.
So, it’s been a problem since Excel 97 at least. Any chance of, you know, fixing it? It’s still here in the current version of Excel for Mac, and while the article only confirms it up to Excel 2003 on Windows, it may well be around in more recent versions there, as well.
[1] This will take a while, so I’m taking advantage of the naff weather to stay in and get on with it.
[2] Other search engines are available, etc
[3] Excel 97 is explicitly named…
[4] Which my file did, as the first row contains the names of the exported fields – “id” and “post_title”, which are what I need to identify the posts I need to edit.
[5] Putting “SYLK” into your choice of search engine may not find that as one of the first few hits.