Hello!
I am currently saving files in my 'Apps' folder using the files_upload() API. I want to save files in a seperate environment than 'Apps' where users are already looking. I believe my Dropbox key has permission to do this, but I cannot figure out the path settings to get this to integrate correctly.
folder = 'testing'
filename = 'test_12_28_23'
path = '/AccountingCloseoutFiles/' + folder + '/' + filename
myRange = np.arange(1,1001,1)
df = pd.DataFrame({"numbers": myRange})
try:
with io.BytesIO() as stream:
with pd.ExcelWriter(stream) as writer:
df.to_excel(writer, sheet_name='test',
index=False)
stream.seek(0)
dbx.files_upload(stream.getvalue(),
path,
mode=dropbox.files.WriteMode.overwrite)
except Exception as e:
logger.critical('File was unable to be saved to dropbox.')
logger.critical(f'Error: {e}')
sys.exit(1)
This code works, but it stores data in 'Apps' instead of the 'AccoutingCloseoutFiles' parent folder that I want it in.
Any help is appreciated!