Skip to content Skip to sidebar Skip to footer

Reading An Excel Object Retrieved Using Urllib2

I am getting an Excel file using urllib2 and saving into response below. I want to be able to process this excel file using xlrd or similar. I included some info below, let me know

Solution 1:

Using xlrd, and based on its API documentation, it appears like you can use something similar to this:

book = xlrd.open_workbook(file_contents=response.read())

It doesn't appear to support reading a file object (which, IMO, would be ideal), only taking in a filename itself or the above file_contents method.

If file_contents didn't exist or didn't work, you'd have to use tempfile to write the response to a temporary file and read that.


Post a Comment for "Reading An Excel Object Retrieved Using Urllib2"