FoodData Central is an integrated data system that provides expanded nutrient profile data and links to related agricultural and experimental research. We can use the FoodData Central API to import data from FoodData Central into Google Sheets. In this tutorial, I’ll show you how to connect the FoodData Central REST API to Google Sheets in 5 steps:
Apipheny is an API connector for Google Sheets. You can use Apipheny to connect your Google Sheets to unlimited API data sources, make unlimited API requests, and more. There is a 30 day free trial included.
1.) Install Apipheny by opening the following link on desktop and then clicking the Install button in the Google Marketplace: https://apipheny.io/install
2.) After you’ve installed Apipheny, open a Google Sheet and then click on the Extensions dropdown in the menu at the top.
In the dropdown list you should see Apipheny. Click Apipheny then click Import API to open the Apipheny sidebar in your Google Sheet.
Tip: you can open a new Google Sheet by entering this URL in your browser:
Go to https://fdc.nal.usda.gov/api-key-signup.html and sign up for an API key.
After completing all the required fields, click the Signup button:
After signing up, you will receive the API key:
You will also receive an email containing the API key. You will need the API key in the next steps.
In this section, we’ll show you how to browse the FoodData Central API documentation to find the endpoint that retrieves the information you need from your account. If you already know your API URL, or you want to use the same example URL as us, just skip to Step 4.
First, open the FoodData Central API documentation page: https://fdc.nal.usda.gov/api-spec/fdc_api.html#/
This page contains a list of endpoints, each one with its description:
An example endpoint is Foods, which fetches details for multiple food items using input FDC IDs. The URL for this endpoint is:
If you use this URL, don’t forget to replace FOOD_DATA_ID with a real id and YOUR_API_KEY with your API key.
The endpoint’s documentation contains a short description of the endpoint’s purpose, its HTTP method (GET) and URI, a list of accepted parameters and an example response:
All endpoints can be accessed with the following base domain: https://api.nal.usda.gov/fdc/v1/
Now go back to your Google Sheet and make sure that the Apipheny add-on is open on the Import tab. With the Import tab open, enter these details into the add-on:
API URL: In Step 3, we explained how you can find the FoodData Central API endpoint that you need. Now copy and paste your complete FoodData Central API URL into the Apipheny add-on, where it says API URL Path, followed by any parameters required for your query (if applicable).
For this example, we are using the List endpoint, which returns a paginated list of foods, in the ‘abridged’ format. This is what the whole URL looks like:
If you use this URL, don’t forget to replace YOUR_API_KEY with the value of the API key you previously obtained in Step 2.
Headers aren’t required. You can leave the Headers section blank in Apipheny.
Here’s what our API request looks like in Apipheny:
Finally, the last step is to click the Run button at the bottom of the Apipheny add-on and then wait for the FoodData Central API data to be imported into your Google Sheet. Here’s what our request looked like when completed:
That’s it! You’ve successfully connected your FoodData Central account to Google Sheets using the FoodData Central API, Google Sheets API, and the Apipheny add-on.
After making a successful request to the FoodData Central API, try querying a different FoodData Central API endpoint, or try using one of the more advanced features in the Apipheny add-on.
Make a GET request
Make a POST request
PUT, PATCH, & DELETE Requests
Save requests for later
Schedule requests for automatic updates
Reference cell values in requests
=APIPHENY custom function
Stack multiple URLs in a single request
Run all saved requests at once
Modify your request settings
Import & export saved API settings
Alpha Vantage API
Constant Contact API
Facebook Graph API
Facebook Ads API
Google SERP API
Linkedin Ads API
Product Hunt API
Reddit Ads API
Riot Games API