cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Announcements
Want to learn some quick and useful tips to make your day easier? Check out how Calvin uses Replay to get feedback from other teams at Dropbox here.

Dropbox API Support & Feedback

Find help with the Dropbox API from other developers.

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Re: Malformed file when uploading excel file with python sdk

Malformed file when uploading excel file with python sdk

Flya
Explorer | Level 4
Go to solution

Hi there,

I get a malformed file when I try upload a simple excel file with python sdk

my code looks like:

xls = 'Path\\xxxxx.xlsx'		
	try:
		with open(xls, 'r') as upxls:
			dbx.files_upload(upxlsx.read(),'/test.xlsx', mode=dropbox.files.WriteMode("overwrite"))
     except Exception as e:
	    print e	

Is there a bug in my code or the dropbox python module?

1 Accepted Solution

Accepted Solutions

Greg-DB
Dropbox Staff
Go to solution
You probably need to use open(xls, 'rb') instead of open(xls, 'r'). (Note the 'b' in the mode.) Try that out and let me know if it doesn't help.

View solution in original post

3 Replies 3

Greg-DB
Dropbox Staff
Go to solution
You probably need to use open(xls, 'rb') instead of open(xls, 'r'). (Note the 'b' in the mode.) Try that out and let me know if it doesn't help.

LiamGM
New member | Level 2
Go to solution

Having the same issue, using the same code OP uses and I tried open(xls,'rb') but it's still coming out as corrupted. Any ideas how to sort it?

Greg-DB
Dropbox Staff
Go to solution

@LiamGM Please open a new thread with more details on the issue you're seeing so we can take a look.

Need more support?