Automate TradingView Data Imports To Google Sheets

Reading Time: 5 minutes

This tutorial will learn how to import data from TradingView to Google Sheets using Amigo Data Add-on. You can import various kinds of data like stock quotes, futures, popular indices, forex, and many more. Amigo Data gives you the flexibility to update your data automatically. Just set it up once and let Amigo Data do the job for you.

Shown below is a snippet of daily top gainers data imported from TradingView to Google Sheets.

Top gainers data from TradingView to Google Sheets

To import TradingView data to Google Sheets, we will follow the steps below:

TradingView data imports to Google Sheets

Here’s the step-by-step guide to import TradingView data to Google Sheets.

Install the Amigo Data add-on

Install the Amigo Data Google Sheets add-on from the Google Workspace Marketplace.

Click here to install

Install Amigo for TradingView data imports to Google Sheets

Alternatively, you can get it from Google Sheets.

  • Open a new sheet
  • Go to Extensions→Add-ons→Get add-ons
  • Search for Amigo Data and install

Generate the API key

We’ll be using a third-party TradingView API on RapidAPI to automate TradingVew data imports to Google Sheets.

Sign or log in up to RapidAPI.

Sign up to RapidAPI to import TradingView data to Google Sheets

Once you’re logged in, go to the TradingView API documentation in RapidAPI.

Learn how to automate trading view data imports to google sheets

Choose a subscription plan from the Pricing menu. We’ll choose the Basic plan; you can upgrade any time should you need to. After subscribing to a plan we’ll be able to import TradingView data to Google Sheets.

Click Endpoints to go back to the API documentation and scroll down a bit. You will find your API key under the Header Parameters. This is the RapidAPI key that we’ll use to pull data from TradingView to Google Sheets.

Choose an endpoint

On the left of the API documentation page is a list of available data endpoints we can retrieve from TradingView using the API.

Available data endpoints to import from TradingView to Google Sheets

For this tutorial, let us import from market/get-movers endpoint. This endpoint provides us with movers in different exchanges and different categories.

The header parameter consists of the API key and API host.

In the required parameters section, we have to input the exchange from which to retrieve data. Enter any one from the given options, say, BSE to import BSE data to Google Sheets.

Then in the optional parameter, specify the type of data to fetch. Let’s import stocks with the highest percentage change from BSE to Google Sheets. So, we’ll input percent_change_data in the name field.

TradingView API parameters

Click the Test Endpoint button to run the query.

Testing the TradingView API query

The success message indicates that the endpoints are functioning correctly. 

TradingView API is working correctly

The TradingView API endpoint URL can be found in the Code Snippets section.

Change the language from (Shell) cURL from the dropdown list.

Select the cURL from Shell

Copy the URL excluding the apostrophes and also note the headers. This is the endpoint URL for the data to import to Google Sheets.

TradingView API URL and headers

Import the data from TradingView to Google Sheets

Go back to Google Sheets and launch the Amigo Data extension.

Launch Amigo Data to automate TradingView data imports to Google Sheets

Select Custom API from the list of sources.

Selecting the source in Amigo Data

Enter the API endpoint URL in the API URL field.

Pasting the endpoint

Then expand the Details tab and enter the headers mentioned in the Code Snippets:

Name: X-RapidAPI-Host, Value: trading-view.p.rapidapi.com

Name: X-RapidAPI-Key, Value: your_key

Replace your_key with your RapidAPI key.

TradingView API headers

Then click the PREVIEW button.

Flatten the nested data points and then click IMPORT.

Preview, flatten and import data

The data from TradingView will be imported into Google Sheets is a couple of seconds.

A snippet of the data imported from TradingView to Google Sheets is shown below.

Snippet of TradingView data imported into Google Sheets

You can likewise import other types of data from the Trading View API. Following are some other examples.

Economic calendar data

Using calendar/get-economic-calendar endpoint, you can import economic calendar data by specific date ranges and countries. In the required parameter section, you need to enter from and to dates (YYYY-MM-DD). In the optional parameters, you can specify the country code from the list of supported countries. 

Endpoint to get economic calendar data

Similarly, you can also explore other endpoints. TradingView API has so much to offer. To explore more endpoints go through the documentation of Trading View API. 

After importing the data, set a refresh schedule so that the data are updated automatically at regular intervals. By this, you can automate importing financial market data to Google Sheets. 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 Marketstack data,  Coinmarketcap data, Nasdaq data, and many more. Visit our blog to find out the kinds of data you can import to Google Sheets.

Some related articles you may be interested in:

Get Real-time Stock Data In Google Sheets Using MarketStack API

Import CoinMarketCap Data To Google Sheets

Import Data From Nasdaq To Google Sheets

Leave a Reply

Discover more from Amigo: No-code Data Integrations to Google Sheets

Subscribe now to keep reading and get access to the full archive.

Continue reading