To expand GotToBTru's response: The SO post you linked hints that the StackOverflow-OriginalPoster had somehow create a modern (.xlsx) spreadsheet with the old (.xls) extension. Thus, I'm guessing the same has happened to you (or the reverse: an old spreadsheet created with the new naming convention).
So, here are some possible routes to go down:
- If you want to just fix it for this specific file, just change the file's extension to match the real type (if it's a modern spreadsheet with a .xls extension, rename it .xlsx, or .xlsm if it has macros; if it's an older spreadsheet with a modern extension, rename it .xls).
- If many files are going to be created in the same manner, you'll want to fix the process that created the spreadsheet, rather than just manually (or automatically) renaming mis-created files for years to come. If you would like help with this, and if the code that creates the spreadsheet(s) is also in Perl (using Win32::OLE or any of the excel-spreadsheet-manipulating modules), feel free to post a small, self-contained example (SSCCE) that shows how the spreadsheet is created and saved (and, if possible, also shows the error above when the file is closed and then re-opened). Given that, we might be able to help you fix the code. If the process that creates the spreadsheet isn't in Perl, you should probably either talk to the creator/maintainer of that process (if possible), or find a forum that deals with that environment (Visual Basic for Applications, c/c++, etc).
- If the procedure that creates the excel spreadsheet(s) is non-Perl and/or outside your control or ability to influence, you might want to go the route of automating the rename process. In that case, Perl has a nice builtin rename function. If you write up your rename script, but it's not working quite right, feel free to ask us questions.
Hope this helps
| [reply] |