I'm using wget to download Excel file with xlsx extension. The thing is that when I want to deal with the file using openpyxl, I get the following error: "BadZipfile: File is not a zip file" But when I download the file manually using fire fox, I don't have any problems.

So I checked the difference between the two downloaded files. I found that the manually one's size is much bigger (269.2 kB) compared to the wget one (7.3 kB), though both have the same content when moved to Win and open by MS Excel.

I don't add any options for the wget just use it like wget <downloadLink>

What's wrong with wget and Excel files?

  • 3
    With that low file size, I assume that wget did not really download the Excel file but an HTML error page. This might be caused by missing cookies or too many redirects. Please have a look into the file wget downloaded using file or a text editor and add the information to your question. – Dubu Jan 20 '16 at 11:14
  • @Dubu thanks for the reply. But I copied the two files to Windows to open on MS Excel and the content is the same in both files. – AhmedWas Jan 20 '16 at 13:20
  • What protocol are you using to download the file (is it, by any chance, ftp)? Can you please post the output of wget -S <downloadlink>? – András Korn Jan 20 '16 at 22:01
  • @AndrásKorn sorry, can't do that. It's company confidential – AhmedWas Jan 21 '16 at 15:55
  • 1
    So anonymize/obfuscate it. The specific URL or the filename are not important, only what http headers like content-type, content-length etc. – András Korn Jan 21 '16 at 17:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.