Get Real-Time Stock Data In Google Sheets Using Marketstack API

Reading Time: 4 minutes

Being able to fetch real-time stock data in Google Sheets can help you build your trading strategies. 

Here in this article, we’re going to learn how to import Marketstack data to Google Sheets using Amigo Data, a Google Sheets extension that lets us import all kinds of data into Google Sheets.

Steps to import Marketstack data in Google Sheets

How to import Marketstack data in Google Sheets

1. Install the Amigo Data add-on

Get the Amigo Data add-on from Google Workspace Marketplace. Click here to install.

Amigo Data in Google Workspace Marketplace

2. Get the Marketstack API key

Go to https://marketstack.com/documentation and click on “GET API KEY” 

Marketstack API documentation page to study how to get real-time stock data in Google Sheets using Marketstack API

Fill in the details and click “Sign Up

Marketstack API signup page

After successfully signing up, you will be redirected to a new page where you can see your API access key

Marketstack API access key

3. Choose the data endpoint

Navigate to the Documentation page by clicking Documentation 

Marketstack API access key page

On the left side, under the Features section, choose any of the categories to work with. We’ll choose End-of-day Data. 

Choose End-of-day from the features section

Copy the endpoint URL.

Select the endpoint URL

If you wish to import data of any other stock, you can simply enter the valid stock ticker symbol against the symbols= in the URL. For example, META is the ticker symbol for Meta platforms Inc. 

Note: While copying the end-point URL make sure that you remove the spaces in-between.

4. Import data to Google Sheets

Open a new spreadsheet and launch Amigo Data

Launching Amigo Data in Google Sheets

Select custom API from the list of sources

Selecting the source in Amigo Data

Paste the endpoint in the  API URL field

Pasting the endpoint

In the Details section, delete the access_key as it contains a dummy API key placeholder. 

Click on the delete button

We need to add the original API key to make a valid request.  Click on the “+Query” option

Click to add a query

Enter the “access_key” as the name and your API key in the value section. Click “+ADD QUERY”

Enter the API key in value section

Click the PREVIEW button.

Click on the PREVIEW button

Then flatten and expand the dataset so that they are organized suitably. Once that is done, click the IMPORT button.

Click on the flatten and then import data

A few moments later, you’ll have a spreadsheet populated with the data from Marketstack with the high, close, volume, etc.

Shown below is a snippet of the imported data.

Snippet of the data imported from the marketstack to Google Sheets

You can likewise import dozens of other types of data from Marketstack. Following are some other examples.

Real-time updates

This end-point gives you real-time updates about the Apple stock. The key-value pair is separated by & sign. In the symbols parameter, you can add a symbol of any stock to fetch the data of that particular stock. You can also set the interval (1min, 5min, or 10min) as per your requirements by simply changing the numeric value. 

Note: Replace YOUR_ACCESS_KEY in the URL with your key.

Historical data

Along with the symbols parameter, you can also change the date_from (YYYY-MM-DD) and date_to (YYYY-MM-DD) parameter according to your requirements. 

Dividends data

In the Marketstack documentation page, you can explore more endpoints and try them out. 

After importing the data, you can also set a refresh schedule so that the data are updated automatically at regular intervals. To learn how to set a refresh schedule, follow this link.

There are several other types of data that you can import into Google Sheets using Amigo Data such as Spotify data, Wikipedia data, Reddit data, and many more. 

Some related articles you may be interested in:

https://blog.tryamigo.com/import-data-from-spotify-to-google-sheets/

https://blog.tryamigo.com/import-wikipedia-data-to-google-sheets/

https://blog.tryamigo.com/import-reddit-data-to-google-sheets/