正在将 Excel 个文件上传到保管箱?
Uploading Excel files to dropbox?
我正在尝试通过 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'>
file_upload 方法以字节为输入所以我不明白?
如您在 the docs 中所见,files_upload
需要字节对象,而不是 BytesIO 对象。
以下应该有效:
dbx.files_upload(output.getvalue(), 'my_path/test.xlsx')
我正在尝试通过 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'>
file_upload 方法以字节为输入所以我不明白?
如您在 the docs 中所见,files_upload
需要字节对象,而不是 BytesIO 对象。
以下应该有效:
dbx.files_upload(output.getvalue(), 'my_path/test.xlsx')