Beefy Boxes and Bandwidth Generously Provided by pair Networks
Come for the quick hacks, stay for the epiphanies.
 
PerlMonks  

Re: Reading Excel with different format

by GotToBTru (Prior)
on Aug 29, 2016 at 12:22 UTC ( [id://1170702]=note: print w/replies, xml ) Need Help??


in reply to Reading Excel with different format

Kind of an obvious question, but do the file format and extension match?

But God demonstrates His own love toward us, in that while we were yet sinners, Christ died for us. Romans 5:8 (NASB)

  • Comment on Re: Reading Excel with different format

Replies are listed 'Best First'.
Re^2: Reading Excel with different format
by pryrt (Abbot) on Aug 29, 2016 at 13:27 UTC

    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

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1170702]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others exploiting the Monastery: (1)
As of 2024-04-25 00:16 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found