Level up your Box knowledge with brand new learning paths on Box University. Visit training.box.com to get started

Read box files in python

New post

Comments

4 comments

  • Nayak

    Hi , I stongly recommend you to use the Box Python SDK and authenticate (either via JWT approach or 3 legged Oauth2) and get the access token & client connection setup. Post this you can call the List Folder Items & download required files. Hope this helps

    -1
    Comment actions Permalink
  • George Avetisyan

    Hey, Nayak. I did try everything you just mentioned above, pandas is not able to read excel files. In fact its not reading any files. When I do pd.read_excel () in the parameter I tried to pass content, link to the file, file id, everything. Its not working. Please let me know what is the problem

    0
    Comment actions Permalink
  • Guy Huinen

     

    from io import StringIO
    import pandas as pd

    file_content = client.file(file_id).content()

    s=str(file_content,'utf-8')

    data = StringIO(s)

    df=pd.read_csv(data)

    0
    Comment actions Permalink
  • Shobin Joyakin

    Hi George.. Did you find a way to read Excel file in Box using python script? The solution Guy Huinen shared works only with CSV files.

    0
    Comment actions Permalink

Please sign in to leave a comment.