BOX Python SDK, download excel file
You just need to do the following. This is what I use to read my excel files from box and you can check the content character type and use that when decoding.
It works really nice for exporting data to Microsoft Excel. The main idea is to use csv. Try this and if you can't, post the code here.
Stack Overflow for Teams — Collaborate and share knowledge with a private group. Create a free Team What is Teams? Collectives on Stack Overflow. Learn more. Using Python to download files from Box Ask Question.
Asked 5 years, 4 months ago. Active 2 years, 4 months ago. Viewed 3k times. I'm trying to use Python to download an Excel file to my local drive from Box. Using the boxsdk I was able to authenticate via OAuth2 and successfully get the file id on Box. Clerin Clerin 96 1 1 silver badge 4 4 bronze badges.
You are most of the way there. What's left should be easier than what you've already done. Check out Python's open built-in function.
Thanks John Y, that worked! I used the open function with the arguments 'wb' for mode and 1 for buffer. As long as I had already created a blank excel file in the local drive then it wrote the downloaded data into the excel sheet including separating it into different tabs.
Excel wasn't happy when I tried to open the excel file manually, but as long as I used the close function first then it was possible to open the excel tabs as dataframes in Python using pandas. Thanks again! Add a comment. Active Oldest Votes. The session layer, responsible for auth and retrying calls. The client layer, which is the interface to your application. In [2]:. Pretty-prints outgoing requests and incoming responses. In [3]:. Create OAuth2 object.
It's already authenticated, thanks to the developer token. We now have a fully authenticated SDK client! Let's try it out. Let's look at the User object.
In [4]:. Now let's look at some different objects, like File and Folder. In [5]:. In [6]:. The SDK makes it very easy to download and upload files. In [7]:. Upload a file to Box!
0コメント