Skip to main content
Question

Read box files in python

  • May 22, 2025
  • 4 replies
  • 30 views

Forum|alt.badge.img

I want to read a set of excel files directly from BOX to my jupyter notebook where I can work with them every-time these files are updated within BOX. I have tried much of the documents available but no luck.

My company has an enterprise version of box and the url looks like abc.ent.box.com

I want to read this url > go to a folder location and read the file from there or directly read the file from the file id.

 

I do have a developers account with client id, client secret and development token available but I am not sure how to use this information while connecting with box. 

 

The basic question, to read box files directly into python

4 replies

Forum|alt.badge.img

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


Forum|alt.badge.img

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


Forum|alt.badge.img

 

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)


Forum|alt.badge.img

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.