I have the below code, which uploads a df in csv format into a sftp server.
with sftp.open(mypath + timestr + '.csv', "w") as f:
f.write(df_pdcs_ec.to_csv(index=False))
However: is there a way to upload that same df but in excel format?
Update: I'm trying to generate the file with 2 tabs as per @furas's answer, but only getting one.
with sftp.open(mypath + timestr + '.xlsx', "wb") as f:
df_pdcs_ec.to_excel(f, sheet_name = 'Test1', index=False)
df_pdcs_ec.to_excel(f, sheet_name = 'Test2', index=False)