Print

Import Dropbox Data to Google Sheets

In this guide, we’ll walk through how to import Dropbox data directly into Google Sheets, using the API Connector add-on for Sheets.

Dropbox only provides short-lived tokens through their developer console, so we'll set up a custom OAuth connection. This will let us automatically fetch and refresh our tokens without any manual intervention.

Contents

Before You Begin

Click here to install the API Connector add-on from the Google Marketplace.

Part 1: Get your Dropbox API Credentials

  1. Log in to the Dropbox developer console at https://www.dropbox.com/developers
  2. Navigate to the App Console and click Create app (or click https://www.dropbox.com/developers/apps/create to go there directly)
    dropbox-createapp
  3. Choose the type of access you need (App folder or Full Dropbox), name your app, and click Create app
    dropbox-configapp
  4. On the Settings tab, enter API Connector's redirect URL (provided here). Make sure to click Add to register the URL.
  5. While you're on this screen, copy the app key and app secret (aka client ID and client secret) as we'll need them shortly. Skip the "Generate" access token function since that will produce a very short-lived token that lasts for just an hour.
    dropbox-settings
  6. Nothing else needs to be changed in Settings, so click over to the Permissions tab, and tick the boxes for all data you'd like to access. When you're done, click Submit. Note: if you need to change or add scopes later, you'll need to delete your app and create a new one.
    dropbox-permissions
  7. By default, apps will be in Development mode, which is fine. That just means this app will only fetch data for your own account, and you can skip the Branding and Analytics tabs.


Part 2: Connect Dropbox to API Connector

  1. Open up Google Sheets and click Extensions > API Connector > Manage Connections
  2. Scroll to the bottom of the sidebar and click Add Custom OAuth
  3. Fill in the Custom OAuth modal as follows:
    • OAuth Grant TypeAuthorization Code
    • NameCustom Dropbox
    • Authorization Base URLhttps://www.dropbox.com/oauth2/authorize?token_access_type=offline
    • Token URLhttps://api.dropbox.com/oauth2/token
    • Client IDapp key provided by Dropbox
    • Client Secretapp secret provided by Dropbox
  4. Click Save
    dropbox-customoauth
  5. Click Manage Connections to return to the list of connections
  6. Scroll down until you find your new custom connection. Click Connect
    dropbox-customconnect
  7. You'll be prompted to give access to the new app you created above. Click Allow
    dropbox-allow
  8. You'll be returned to your sheet and can verify that the new connection is now active.

Part 3: Get Dropbox Data in Sheets

You can see the full list of available endpoint and parameters in the API documentation. For example, to get a list of the files in the root folder of your Dropbox account, run a request like this:

  1. Open up Google Sheets and click Extensions > API Connector > Open > Create request.
  2. In the request form enter the following:
    • ApplicationCustom
    • MethodPOST
    • Request URLhttps://api.dropboxapi.com/2/files/list_folder
    • OAuth: Custom Dropbox
    • Request body: {"include_deleted":false,"include_has_explicit_shared_members":false,"include_media_info":false,"include_mounted_folders":true,"include_non_downloadable_files":true,"path":"","recursive":false}
    • Request body type: json
  3. Create a new tab and click Set current to use that tab as your data destination.
  4. Name your request and click Run. A moment later you’ll see a list of files populate your sheet.
    dropbox-oauthresponse

Note:

The above request contains "path":"", indicating that it's fetching files from the root directory. To get files from a particular folder, replace the empty quotes with the folder's path, e.g. {"include_deleted":false,"include_has_explicit_shared_members":false,"include_media_info":false,"include_mounted_folders":true,"include_non_downloadable_files":true,"path":"/my test folder","recursive":false}.

Part 4: API Documentation

Official API documentation: https://www.dropbox.com/developers/documentation/http/documentation

To view or disconnect your app on Dropbox's side, click here: https://www.dropbox.com/account/connected_apps

2 thoughts on “Import Dropbox Data to Google Sheets”

  1. Hi Ana,

    Thanks so much.

    Can you please provide an example of what the path should look like? I've pasted exactly the path in the URL, and it doesn't work: {"include_deleted":false,"include_has_explicit_shared_members":false,"include_media_info":false,"include_mounted_folders":true,"include_non_downloadable_files":true,"path":"/Cool%20People%20-%20(Use%20This%20Folder)/Agency/Untried%20-%20please%20test!/AU%20Content%20Creators","recursive":false}

    From testing a bunch of variations, I know that the path is the issue!

    Reply
    • I made a test folder in my dropbox called My Test Folder, and added a file into that folder. I then fetched the contents of that folder with this request body: {"include_deleted":false,"include_has_explicit_shared_members":false,"include_media_info":false,"include_mounted_folders":true,"include_non_downloadable_files":true,"path":"/my test folder","recursive":false}
      Does that help? Feel free to share more info about your Dropbox setup through the support page if you'd like me to take a look.

      Reply

Leave a Comment

Jump To