Import data via API
Use secrets and Python to import data to your Hex project with an API
- Users will need Can Edit or higher permissions.
Any data accessible via API can be pulled into your Hex project. For example, you can pull in data from Spotify, the US Census, Google Sheets, or any other service with an API.
Store your API key as a secret
Depending on the API you're using, there may be different requirements for setting up an account and acquiring API credentials.
Once you have your API key you can store it as a secret in your Hex project. From the Variables sidebar in your Hex project, locate the Secrets section and click +Add to create a new secret.
Connect to your data source
You can then add a Python cell to your project where you can import any required packages, create your connection using your API key stored in your secret, and defining an API scope as needed.
Check out our tutorial on connecting Hex to Google Sheets via API to see an example in practice.