In this article, we’ll learn how to import NSE data to Google Sheets using Amigo Data, a data automation tool. We’ll be using a third-party data provider called EOD Historical Data. It has data from all major exchanges, including the National Stock Exchange of India (NSE) and the Bombay Stock Exchange (BSE), and covers most stocks, ETFs, indices, and mutual funds.
With these two tools, we can extract most stock data to Google Sheets. And not just stock data but also exchanges related information such as stock market trading hours, and holidays list among other things.
In the snippet shown below, we have the EOD historical data of HDFC Bank from NSE in Google Sheets.
We’ll import NSE data in Google Sheets following the steps below:
- Install the Amigo Data add-on
- Register on EOD Historical Data
- Get the data endpoint
- Import the data to Google Sheets
How to import NSE data to Google Sheets
Follow the steps below to import NSE data in Google Sheets and automatically update the data to fetch live NSE data to Google Sheets.
1. Install the Amigo Data
Get the Amigo Data add-on from Google Workspace Marketplace.
Click here to install.
2. Register on EOD Historical Data and get API token
Since NSE does not have an official API, we’ll use a third-party data provider to get NSE data in Google Sheets.
Go to https://eodhistoricaldata.com/ and click the Registration button.
Fill in the details and click Register.
Upon clicking Register, you’ll be taken to the account’s settings page where the API token can be found.
Note the API token. We’ll use this to retrieve data from EOD Historical Data and import NSE data in Google Sheets.
3. Get the endpoint of the NSE data to import
Move the pointer to Documentation and select End Of Day API or any of the data types to retrieve NSE data and export them to Google Sheets.
On the left of the screen are listed the available endpoint categories. In the middle is given an example API endpoint URL and mentioned underneath are the different parameters that can be used to retrieve specific data and filter them.
We can modify this URL to get the data of our choice. For example, to retrieve end-of-day historical data for HDFC Bank from NSE from 1 June 2022 to 30 September 2022, the URL will be as given below.
Remember to change the output format from the default CSV to JSON by appending &fmt=json in the URL. And replace YOUR_API_KEY with your API token.
We can get the end of day data for any other company listed in the NSE by changing the ticker symbol and the exchange symbol. For example, to import EOD information for Reliance Industries from NSE to Google Sheets, we’d use the following endpoint URL.
We can also retrieve stock information from the Bombay Stock Exchange. We need only replace the exchange symbol.
The URL endpoint below will fetch the EOD data for Airtel from BSE. We have included the limit parameter to fetch only 100 results.
We can now begin to import NSE data in Google Sheets from EOD Historical Data.
4. Import the data to Google Sheets
Launch Amigo Data from Google Sheets to get the NSE data in Google Sheets by clicking Extensions->Amigo->Connect.
Select Custom API from the list of sources.
Paste the endpoint in the API URL field to get NSE data in Google Sheets.
Click the PREVIEW button to get the preview of the NSE data to import to Google Sheets.
Click the FLATTEN button so that the nested data are placed in different columns. Flatten and expand until all the data sets have been placed in a separate columns.
Then click the IMPORT button to import the NSE data to Google Sheets.
The NSE data will be imported into Google Sheets in a few seconds.
A snippet of the NSE data imported into Google Sheets.
And that is how we get NSE data in Google Sheets. But this is not the end of it. You can automate data imports from NSE to Google Sheets by setting a refresh schedule in Amigo.
There are several types of data that we can get from NSE to Google Sheets such as intraday historical data, real-time stock data, live stock prices, options data and many more. (Most of these however require a subscription.) Visit the API documentation for more details.
You can get these data updated automatically at regular intervals–hourly, daily, weekly, or on certain days–so that you always have the NSE live data in Google Sheets. And you can have this information sent to your email or a Slack channel. Click here to learn how to set a refresh schedule and set up alerts in Amigo Data.
Commonly asked questions
How do I import NSE options data to Google Sheets?
To import options data, navigate to the Options Data API. Then choose the endpoint URL and modify by replacing the default ticker with the stock ticker for which you want to import the options data to Google Sheets and specify the option parameters such as expiration date, contract name and last trade date and time to filter the data according to your preference.
For example, to get the options data for Infosys, we can use the endpoint below.
How do I get real-time stock prices in Google Sheets?
To get real-time stock prices to Google Sheets, use the Live (Delayed) Stock Prices API. Specify in the URL the tickers for which you want to get the real-time stock prices and import the data to Google Sheets using Amigo Data. Then set a refresh schedule so that the data is automatically updated at regular intervals.
You’ll then have live NSE data in your Google Sheets that are updated periodically. Note, though, that the live data provided by EOD Historical Data is delayed by about 15 minutes.
Does NSE provide an API?
No, NSE does not provide an API. But we can use third-party data providers such as eodhistoricaldata.com to get NSE data in Google Sheets or build a stock trading app. These third-party APIs are designed specifically for retrieving data and are therefore easy to use and versatile.
There are plenty of data that you can import to Google Sheets from various sources using the Amigo Data add-on. A few examples are Indian government Open Data, Wikipedia data, Reddit Data, AccuWeather, and Binance.
Visit our blog to find these and many other articles on Google Sheets.
Here are some similar articles that you may be interested in:
Import Yahoo Finance Data Into Google Sheets
Import TD Ameritrade data to Google Sheets
Import CoinMarketCap Data To Google Sheets