I'm interested in comparing two versions of smallish Excel files stored in Dropbox as separate version.
Using the Python SDK, specifically the files_download() method, I'm getting a requests.models.Response object, but I'm having trouble getting pandas.read_excel() to consume it.
Here's the code snippet:
with open(resp.content, "rb") as handle:
df = pandas.read_excel(handle.read())
The error:
TypeError('file() argument 1 must be encoded string without null bytes, not str',)
I know I'm missing something fundamental, possibly needing to encode the file as a binary. (Tried base64.b64encode, and some other things, with no success yet.) I'm hoping someone can help me with a point in the right direction, possibly with the io module?
I'm using Python 2.7.15
For the avoidance of doubt, I'm specifically looking to avoid the step of first saving the Excel files to the filesystem. I'm sure I can accomplish the broader objective that way, but to optimize I'm trying to read the files from Dropbox directly into pandas DataFrames, and the fact that the read_excel() method takes a file-like object means—I think—that I should be able to do that.
Basically, I think this sums up the pain I'm experiencing at the moment. I need to get the response from Dropbox into the form of a file-like object.