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:

  1. 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).
  2. 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).
  3. 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


In reply to Re^2: Reading Excel with different format by pryrt
in thread Reading Excel with different format by 9mohit2

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.