title: How do I read an Excel file directly from Dropbox's API using pandas.read_excel()?
body: <p>I'm interested in comparing two versions of smallish Excel files stored in Dropbox as separate version.</p>
  
  <p>Using the Python SDK, specifically the <a href="https://dropbox-sdk-python.readthedocs.io/en/latest/moduledoc.html#dropbox.dropbox.Dropbox.files_download" rel="nofollow noreferrer">files_download() method</a>, I'm getting a requests.models.Response object, but I'm having trouble getting <a href="https://pandas.pydata.org/pandas-docs/version/0.22/generated/pandas.read_excel.html" rel="nofollow noreferrer">pandas.read_excel()</a> to consume it.</p>
  
  <p>Here's the code snippet:</p>
  
  <pre><code>with open(resp.content, "rb") as handle:
      df = pandas.read_excel(handle.read())
  </code></pre>
  
  <p>The error:</p>
  
  <pre><code>TypeError('file() argument 1 must be encoded string without null bytes, not str',)
  </code></pre>
  
  <p>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?</p>
  
  <p>I'm using Python 2.7.15</p>
  
  <p>For the avoidance of doubt, I'm specifically looking to avoid the step of first saving the Excel files to the filesystem. I'm <em>sure</em> 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-<em>like</em> object means—I <em>think</em>—that I should be able to do that.</p>
  
  <p>Basically, I think <a href="https://github.com/requests/requests/issues/465" rel="nofollow noreferrer">this</a> 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.</p>