You might see that the Dropbox Community team have been busy working on some major updates to the Community itself! So, here is some info on what’s changed, what’s staying the same and what you can expect from the Dropbox Community overall.

Forum Discussion

ms97's avatar
ms97
Explorer | Level 3
11 months ago

I want to save a file outside of the Apps folder

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! 

    • ms97's avatar
      ms97
      Explorer | Level 3

      Thank you for the information! My app has full Dropbox access already, but no matter what path I give it, it is stored in the App folder.  I have two apps one is limited to 'App folder' and one is not.  When using bi_automation, it still only stores files inside the app folder. Is there a way to change this?

      • Здравко's avatar
        Здравко
        Legendary | Level 20

        ms97 wrote:

        ...  When using bi_automation, it still only stores files inside the app folder. ...


        What do you mean when you say "using bi_automation"? 🤔 Did you change only the app key only and continue use the existing tokens or perform full re-authentication? 🙂

  • Здравко's avatar
    Здравко
    Legendary | Level 20

    Hi ms97,

    No, your application doesn't have such permission. You have limited your application permission to access (not only save) files and/or folders within app specific folder only and nothing outside. That's your choice! As seems, this choice is unintentional. You need full access application, not app' folder type! Unfortunately, such permission cannot get changed (unlike other permissions, like scopes, for instance). You need to recreate your application and select correct application type at creation moment (as noted, later cannot change).

    Hope this helps.