Gasoline, colloquially called gas, is one of the major economic inputs used in the manufacturing process. Higher gas prices lead to higher manufacturing costs. To maintain profitability, firms increase the prices of their commodities, which eventually leads to higher inflation.
To keep a track of the inflationary pressure in the economy and stay updated on the prevailing gas price, you can import gas price data to Google Sheets and obtain a list of places and the price at which gas is sold there. This can be done using a free gas price API with a data automation tool called Amigo.
But before we drive on further, here’s a foretaste of what you’d get with the gas price API.
To import gasoline price data to Google Sheets, follow the steps mentioned below.
How to import gasoline price data to Google Sheets
Follow the steps given below to learn how to import gasoline price data to Google Sheets.
Step 1: Get the API key
We’ll use a gas price API called Gas Price on RapidAPI, an online API marketplace.
Login to RapidAPI here. If you don’t have an account created, you will need to click the Sign-up option and create one.
Once logged in, search for gas price API or simply click here to go directly to the Gas Price API we’ll use to import gasoline price data to Google Sheets.
Click on the Subscribe to Test option and choose the plan you wish to subscribe to. The paid plans will allow you to make significantly more requests than the free plan, i.e., the Basic Plan.
On subscribing to the Gas Price API, we’ll be able to import gas prices into Google Sheets.
Upon subscribing your API key will be generated and automatically added as one of the required parameters in the API documentation segment.
Now that we have the gas price API and the API key, we can now use the Gas Price API to import gas prices to Google Sheets.
Step 2: Choose the API endpoint
In the leftmost section of the API documentation, you will find the list of endpoints available with which you can import gasoline price data to Google Sheets.
For the purpose of this article, we will import the average current gas prices across all states in the USA. To do so, click on America→ allUsaPrice.
The gas price API endpoint URL as well as the API headers can be found in the Code Snippets section.
Click on Code snippets and change the programming language from (Node.js) Axios→ Shell→cURL.
Copy the Gas Price API endpoint URL and take note of the headers and their values. The same will be used later while using the Amigo extension to establish a connection between the sheet wherein you want the data and the source from where the data are to be imported.
Step 3: Get Amigo Google Sheets extension
The Amigo Add-on is an extension in Google Sheets that allows you to import data from various sources and automatically update them without any coding.
You can either install the extension directly from the Google Workspace Marketplace by clicking the link below.
You can also install it from Google Sheets by following the steps below:
- Open a new google sheet
- Click on Extension→ Add-ons→ Get Add-on
- Search for “Amigo” and install it.
Once the installation is complete, you’ll be able to automatically pull gas prices into Google Sheets using the gas price API.
Step 4: Import gas prices to Google Sheets
Go to the Google Sheet in which you want the gas prices to be extracted and launch Amigo Data. Click on Extensions→Amigo→Connect.
Select Custom API from the list of sources.
Enter the Gas Price API endpoint URL copied earlier under the API URL section. Select the Details tab and add the following headers along with their values noted earlier in the Code Snippets and click PREVIEW.
Click on Flatten to present the nested datasets in separate columns. Once the data are separated into columns, click on IMPORT.
Amigo Add-on will shortly import gasoline price data to Google Sheets. This sheet will become a one-stop platform that provides you with the current price at which gas is sold across all the states in the US.
To ensure that you always have the latest gas prices in your spreadsheet, set a refresh schedule and Amigo will update the gas prices periodically as regular interval–hourly, daily, or on certain hours or days.
To learn how to automatically update your data at regular intervals and receive alerts for the same on your email or Slack channel, click here.
In this article, we learned to import gasoline price data to Google Sheets. To learn how to import data from other sources, check out our blog.
Here are a few other articles that you might find useful.