Skip to main content
Question

Use file.content() or file.download_to() -> to data frame

  • May 22, 2025
  • 2 replies
  • 17 views

Forum|alt.badge.img

Using Python SDK in a Juypter Notebook

Say I have an Excel or CSV on Box. I need the contents of the file and put it into a pandas data frame for further processing.

Is it better to use file.content() or temporarily download the file to a local network drive?

 

 

2 replies

Forum|alt.badge.img

Hi ,

 

file.content() will download the file content into a local variable. If you can inject the file content directly into the data frame that way then it'll be the easiest method. If the frame needs to reference a local file in the file system then save the content to a local file.

 

- Jon


Forum|alt.badge.img

 Thank you! Do you know if content() will retry if there's a connection issue during the process? Some of the CSV/Excel files we'd like to read are large files, a bit worried about lost bytes if we use content(). Or will it just fail and return an error code?