title: How to read SharePoint Online (Office365) Excel files into Python specifically pandas with Work or School Account?
body: <p>The question is very similar to the link below. 
  <a href="https://stackoverflow.com/questions/48424045/how-to-read-sharepoint-online-office365-excel-files-in-python-with-work-or-sch/49461895#49461895">How to read SharePoint Online (Office365) Excel files in Python with Work or School Account?</a></p>
  
  <p>Essentially I would like to import an excel file off SharePoint into pandas for further analysis.</p>
  
  <p>The issue is when I run the code below I get the following error.</p>
  
  <pre><code>XLRDError: Unsupported format, or corrupt file: Expected BOF record; found b'\r\n&lt;!DOCT'
  </code></pre>
  
  <p>My code:</p>
  
  <pre><code>from office365.runtime.auth.authentication_context import AuthenticationContext
  from office365.sharepoint.client_context import ClientContext
  from office365.sharepoint.file import File 
  
  url = 'https://companyname.sharepoint.com/SitePages/Home.aspx'
  username = 'fakeaccount@company.com'
  password = 'password!'
  relative_url = '/Shared%20Documents/Folder%20Number1/Folder%20Number2/Folder3/Folder%20Number%Four/Target_Excel_File_v4.xlsx?d=w8f97c2341898_random_numbers_and_letters_a065c12cbcsf=1&amp;e=KXoU4s'
  
  
  ctx_auth = AuthenticationContext(url)
  if ctx_auth.acquire_token_for_user(username, password):
    ctx = ClientContext(url, ctx_auth)
    web = ctx.web
    ctx.load(web)
    ctx.execute_query()
    #this gives me a KeyError: 'Title'
    #print("Web title: {0}".format(web.properties['Title']))
    print('Authentication Successful')
  else:
    print(ctx_auth.get_last_error())
  
  
  import io
  import pandas as pd
  
  response = File.open_binary(ctx, relative_url)
  
  #save data to BytesIO stream
  bytes_file_obj = io.BytesIO()
  bytes_file_obj.write(response.content)
  bytes_file_obj.seek(0) #set file object to start
  
  #read file into pandas dataframe
  df = pd.read_excel(bytes_file_obj)
  
  print(df)
  </code></pre>