Gmail Calendar Documents Reader Web more »
Recently Visited Groups | Help | Sign in
Google Groups Home
Opening Excel File With XLRD - Getting file size warning
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  3 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Anthony Graddy  
View profile  
 More options Oct 10, 2:07 pm
From: Anthony Graddy <anthonygra...@gmail.com>
Date: Fri, 9 Oct 2009 21:07:25 -0700 (PDT)
Local: Sat, Oct 10 2009 2:07 pm
Subject: Opening Excel File With XLRD - Getting file size warning
Hi,

I uploaded three files to the group.

I need to process an "Excel file" (maybe it's something else?) that I
downloaded from this website:
http://infopost.panhandleenergy.com/InfoPost/jsp/frameSet.jsp?pipe=pepl

When I try to open the original.xls file, I get this warning:
WARNING *** file size (80900) not 512 + multiple of sector size (512)

If I open the file in Open Office, it opens just fine and all of the
data appears correct. Is there a way for me to get xlrd to open it
too?

I'm able to resave the file in Open Office as a Microsoft Excel
97/2000/XP file (the resaved.xls file) and it opens just fine in xlrd.

Any ideas what the problem is with the original file (there is
obviously a file size difference when it gets resaved)? Anyway I can
access it without having to open and resave in Open Office?

Thanks,
Anthony Graddy


    Reply    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
John Machin  
View profile  
 More options Oct 10, 4:01 pm
From: John Machin <sjmac...@lexicon.net>
Date: Sat, 10 Oct 2009 17:01:36 +1100
Local: Sat, Oct 10 2009 4:01 pm
Subject: Re: [pyxl] Opening Excel File With XLRD - Getting file size warning
On 10/10/2009 3:07 PM, Anthony Graddy wrote:

> Hi,

Hi Anthony, and welcome to the group.

> I uploaded three files to the group.

> I need to process an "Excel file" (maybe it's something else?) that I
> downloaded from this website:
> http://infopost.panhandleenergy.com/InfoPost/jsp/frameSet.jsp?pipe=pepl

> When I try to open the original.xls file, I get this warning:
> WARNING *** file size (80900) not 512 + multiple of sector size (512)

> If I open the file in Open Office, it opens just fine and all of the
> data appears correct. Is there a way for me to get xlrd to open it
> too?

Yes, the way that you tried. WARNING != error.

> I'm able to resave the file in Open Office as a Microsoft Excel
> 97/2000/XP file (the resaved.xls file) and it opens just fine in xlrd.

> Any ideas what the problem is with the original file

It has 4 extra bytes after the normal payload. Inspection with a hex
editor shows that they are "\r\n\r\n". No other apparent damage. If you
have the appropriate relationship with the source, you might like to
hint gently that they may like to avoid having crazy people in the
pipeline between the file creation and its appearence on the web.

> (there is
> obviously a file size difference when it gets resaved)?

That difference often happens. It's not a cause for concern.

 > Anyway I can

> access it without having to open and resave in Open Office?

Just ignore the warning. If you don't like the warning coming out, you
could write a small wrapper function that opens the file with builtin
open(..., mode='rb'), reads it into say "buff" and checks the filesize:
(a) size % 512 == 0: use open_workbook(..., file_contents=buff)
(b) (size % 512 == 4) and buff.endswith("\r\n\r\n"): use
open_workbook(..., file_contents=buff[:-4])
(c) otherwise they're doing something different ... better check it out.

Cheers,
John


    Reply    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Anthony Graddy  
View profile  
 More options Oct 13, 4:26 am
From: Anthony Graddy <anthonygra...@gmail.com>
Date: Mon, 12 Oct 2009 11:26:40 -0700 (PDT)
Local: Tues, Oct 13 2009 4:26 am
Subject: Re: Opening Excel File With XLRD - Getting file size warning
Thank you! That helped a lot.

On Oct 10, 1:01 am, John Machin <sjmac...@lexicon.net> wrote:


    Reply    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »

Create a group - Google Groups - Google Home - Terms of Service - Privacy Policy
©2009 Google