DataLab Docs
  • What is DataLab?
  • Work
    • Creating a workbook
    • Sharing a workbook
    • Managing a workbook
    • Code cell
      • Working with packages
    • Text cell
      • Including images
    • SQL cell
      • SQL scenarios
      • Parameterize your SQL query
    • Explore Data cell
    • Chart cell
      • Configuring your chart
      • Pivot charts
      • Migration guide
    • AI Assistant
    • Version history
    • Scheduled runs
    • Hiding and showing cells
    • Long-running cells
    • Report view
    • Environment variables
    • Git and GitHub
  • Connect to Data
    • Connect your data to DataLab
    • Sharing a Data Source
    • Airtable
    • Amazon Athena
    • Amazon S3
    • Databricks
    • Dropbox
    • Files
    • Google Drive
    • Google BigQuery
    • Google Sheets
    • MariaDB
    • Microsoft SQL Server
    • MongoDB
    • MotherDuck
    • MySQL
    • Oracle Database
    • PostgreSQL
    • Redshift
    • Snowflake
    • Supabase
  • Guides
    • Publish a notebook
    • Importing data from flat files
    • Resizing plots
    • Show Bokeh and Pyvis plots
  • Resources
    • Pricing
    • Manage group settings
    • Reporting for Group Admins
    • DataLab for education
    • Technical requirements
    • Addressing slow code
    • Address R vulnerability
    • Get help
Powered by GitBook
On this page

Was this helpful?

  1. Connect to Data

Dropbox

PreviousDatabricksNextFiles

Last updated 11 months ago

Was this helpful?

This article covers all the necessary steps to access and manage files on Dropbox from inside DataLab. The guide assumes that you already have a Dropbox account.

Setup

Sign in to your Dropbox account, head over to and click "Create app".

In the app creation form:

  • Select the "Scoped access" API.

  • Choose the type of access you need.

  • Specify a name for your app.

After the app is created, head over to the Permissions tab and select the correct access scopes for what you intend to do. For example, if you only want to use Workspace to programmatically read content from Dropbox, files.metadata.read and files.content.read is enough. Make sure to click "Submit" in the footer to persist the changes.

Go back to the settings tab, and in the OAuth 2 section click "Generate" to generate an access token. Copy the access token to your clipboard.

  • In your workbook, open "Environment > Environment variables..." in the menu bar, and click on "Add". You need to create a new set with one environment variable:

    • Set Name to DROPBOX_ACCESS_TOKEN

    • In Value paste the access token that you copied to your clipboard in the previous step.

  • Set the "Environment Variable Set Name" to something meaningful, e.g. "Dropbox Access Token"

  • Click "Create", "Next" and finally, "Connect". Your workspace session will restart, and DROPBOX_ACCESS_TOKEN will now be available as an environment variable in your workspace session.

Securely store the access token as an in Workspace:

If you've done all of the steps above successfully, you're now ready to run some Python code to access Dropbox files! The code is available in ; you can click to create your own copy that you can edit to your use case.

environment variable
this workspace
this link
https://www.dropbox.com/developers/apps
Create a Dropbox App
Select access scopes for your dropbox app
Generate access token
Store access token as an environment variable in Workspace