How to import data from the NASA API into Google Sheets

NASA is a U.S. government agency responsible for the civil space program and space research. We can use the NASA API to import data from NASA into Google Sheets. In this tutorial, we’ll show you how to connect the NASA REST API to Google Sheets in 5 steps:

  1. Install the Apipheny add-on
  2. Obtain an API key
  3. Choose a NASA API endpoint
  4. Enter your NASA API request into Apipheny
  5. Run the NASA API request in your Google Sheet

Step 1.) Install and open the Apipheny add-on for Google Sheets

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.

open apipheny

Tip: you can open a new Google Sheet by entering this URL in your browser: sheet.new

Step 2.) Obtain an API key

  1. Go to https://api.nasa.gov/
  2. Click the Generate API key option in the top menu
  3. Complete all the fields required
  4. Click the Signup button:
Generate API key section
Generate API key section

Your API key will then be generated:

API key displayed on the screen
API key displayed on the screen

Copy your API key to a safe location because you’ll need it later!

Step 3.) Choose a NASA API endpoint

In this section, we’ll show you how to browse the NASA API documentation to find an endpoint that retrieves the data you need from NASA. 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 NASA API documentation page: https://api.nasa.gov/#browseAPI

The main section contains a list of endpoints for the NASA API:

NASA API documentation page
NASA API documentation page

An example endpoint is Earth, which provides Landsat imagery data:

https://api.nasa.gov/planetary/earth/imagery?lon=100.75&lat=1.5&date=2014-02-01&api_key=DEMO_KEY

If you use this URL, make sure to replace the lon, lat, date, and api_key parameters with your own values!

The endpoint’s documentation contains a description of the endpoint’s purpose, example image, its HTTP method (GET), the URI, the query parameters, the Assets section and example query:

Earth endpoint documentation
Earth endpoint documentation

All API calls to the NASA API should be made to this base URL: https://api.nasa.gov/

Step 4.) Enter your NASA API request into Apipheny

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:

Method: At the top of the Apipheny sidebar, select the HTTP method (GET, POST, PUT, etc) required by your API endpoint. For this example, we are using the GET method.

API URL: In Step 3, we explained how you can find the NASA REST API endpoint that you need. Now copy and paste your complete NASA 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 APOD endpoint, which structures the APOD imagery and associated metadata so that it can be repurposed for other applications. This is what the whole URL looks like:

https://api.nasa.gov/planetary/apod?api_key=API_KEY

If you use this API URL, make sure to replace API_KEY with the key you previously obtained in Step 2.

Here’s what our NASA API request looks like in Apipheny:

NASA API request entered into Apipheny
NASA API request entered into Apipheny

Step 5.) Run the NASA API request in your Google Sheet

Finally, the last step is to click the Run button at the bottom of the Apipheny add-on and then wait for the NASA API data to be imported into your Google Sheet. Here’s what our request looked like when completed:

NASA data imported into Google Sheets
NASA data imported into Google Sheets

After successfully calling the NASA API, try calling a different endpoint, or try one of Apipheny’s other features to enhance your API calls.



Crypto API tutorials and more:


API Tutorials



API Knowledge

What is an API?

What is an API URL?

What are parameters?

What is an endpoint?

What is an API key/token?

What is basic authentication?

What are headers?

What is a GET request?

What is a POST request?


Sponsored by Zink Virtual Tip Jar & Rewording.io Paraphrasing Tool

Accept tips and donations on Twitch | Accept tips and donations on Discord | Accept tips and donations on YouTube | Accept tips and donations on Telegram | Accept tips and donations on Twitter | Accept tips and donations on TikTok | Accept tips and donations on Instagram | Accept tips and donations on LinkedIn | Accept tips and donations on Facebook | Accept tips and donations on your Website