In this article, we’ll learn how to import the latest fuel prices in India to Google Sheets using fuel price API.
Shown below is a snippet of the latest fuel prices in India imported into Google Sheets.
Fuels such as petrol and diesel are indispensable commodities. They move the economy; and their scarcity can be a huge drag on the economy. And they move us–literally. They are, in short, the blood that keeps economies alive and life running.
Which is why it’s important to keep watch over these volatile commodities. The prices fluctuate daily and also vary significantly enough across states and cities to leave a noticeable dent in one’s budget. So, it’s essential to stay up-to-date with the fuel prices and the variation of prices across regions.
We can import fuel prices in India for all states and also compare fuel prices across cities in Google Sheets using Amigo, a data integration and automation tool. Amigo is an essential fuel for all businesses looking to turbocharge their growth.
Steps to import the latest fuel prices in India to Google Sheets:
How to import the latest fuel prices in India to Google Sheets
Follow these steps to get fuel prices in India in Google Sheets using fuel price API.
Step 1: Install the Amigo add-on
Get the Amigo Data add-on from Google Workspace Marketplace to import the latest fuel prices in India to Google Sheets.
Click here to install.
Step 2: Get the API endpoint URL
We’ll use a fuel price API called “Daily Petrol, Diesel, LPG & CNG Fuel Prices in India” from RapidAPI, an API marketplace, to retrieve fuel price data. Log in (or sign up if you don’t have an account yet).
Click on the Subscribe to Test button and subscribe to a plan of your choice, post which we’ll be able to make calls to the API and import the latest fuel prices in India to Google Sheets.
Click Endpoints to go back to the API Playground. On the left of the fuel price API documentation page are the available endpoints.
Expand any of the categories and click on an endpoint within the category. For example, to get the current fuel prices in all the states, click the AllStatesFuelPricesToday endpoint in Today’s Fuel Prices.
Step 3: Import the latest fuel prices in India to Google Sheets
Open Google Sheets and launch Amigo to import the fuel prices data to Google Sheets. To connect to Amigo, click Extensions→Amigo: Data Exports and Reports→Connect.
We’ll be presented with a list of sources to connect and import data from on the sidebar. Select Custom API.
Enter the fuel price API endpoint URL (without the apostrophes) in the API URL field.
Then expand the Details tab and enter the headers. The headers can be found in the Code Snippets. The characters to the left of the colon are the header names/keys and those to the right are the header values. Enter these as separate headers. Do not include the apostrophes.
Name: X-RapidAPI-Key, Value: YOUR_API_KEY
Name: X-RapidAPI-Host, Value: daily-petrol-diesel-lpg-cng-fuel-prices-in-india.p.rapidapi.com
The latest fuel prices data will be imported into Google Sheets in a moment. The data include prices of petrol, diesel, LPG and CNG for all the states in India and price change information. Below is a snippet of the data.
We can likewise import fuel prices for a particular state or a specific city, city with the highest and lowest prices, and historical price data among others.
Once the data have been imported, you need only set a refresh schedule and the data will be updated automatically at regular intervals. And not only that, you can receive the updated data in your inbox and Slack so that the data follow you.
Know more about setting up alerts and automatic refresh schedule in Amigo.
Some related questions
How do I get historical petrol prices in India in Google Sheets?
To get historical prices of fuels like petrol, diesel and CNG, use the “Fuel prices on a past date” API. From there select the endpoint–whether you want to fetch the historical fuel price data for all states, for a state, or a city or all cities. Then copy the API endpoint URL and the headers and import the data to Google Sheets using Amigo Data.
Can I get the petrol price in India since 2000?
This fuel price API does not have historical data dating that long back. It does have the historical data for the last 30 days for all states and most major cities of India and the current fuel prices.
Can I get the fuel price data for a specific day?
Yes, you can get the fuel price data for a specific day if the date is no older than 30 days. Expand the “Fuel Prices on a past date” API and specify the date and the state for which you want to get the fuel prices.
Some recommended articles: