Python 是否将Excel文件上载到dropbox?

Python 是否将Excel文件上载到dropbox?,python,pandas,export-to-excel,dropbox-api,Python,Pandas,Export To Excel,Dropbox Api,我正试图通过pandas上传我正在使用ExcelWriter创建的文件 以下是我到目前为止的情况: output = BytesIO() writer = pd.ExcelWriter(output, engine='xlsxwriter') df1.to_excel(writer, sheet_name='raw_data', index=False) df_totals.to_excel(writer, sheet_name='totals', index=False) writer.sav

我正试图通过pandas上传我正在使用ExcelWriter创建的文件

以下是我到目前为止的情况:

output = BytesIO()
writer = pd.ExcelWriter(output, engine='xlsxwriter')
df1.to_excel(writer, sheet_name='raw_data', index=False)
df_totals.to_excel(writer, sheet_name='totals', index=False)
writer.save()
output.seek(0)
dbx.files_upload(output, 'my_path/test.xlsx')
它抛出了一个错误:

TypeError: expected request_binary as binary type, got <class '_io.BytesIO'>
TypeError:请求应为二进制类型,已获取
file\u upload方法将字节作为输入,因此我不理解。

正如您在中所看到的,
files\u upload
需要一个bytes对象,而不是BytesIO对象

以下方面应起作用:

dbx.files_upload(output.getvalue(), 'my_path/test.xlsx')