Import Gas Price Data To Google Sheets

Reading Time: 5 minutes

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.

Gas price data imported into Google Sheets

To import gasoline price data to Google Sheets, follow the steps mentioned below.

  1. Generate the API key
  2. Choose the endpoint
  3. Install the Amigo Add-on
  4. Import the data

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.

Gas Price API

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.

Subscribing to the Gas Price API

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.

API key

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.

Gas Price API endpoints available

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.

Changing the coding language

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.

Gas Price API endpoint URL and headers

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.

Install Amigo Data

Install Amigo to import gasoline price data to Google Sheets

You can also install it from Google Sheets by following the steps below:

  1. Open a new google sheet
  2. Click on Extension→ Add-ons→ Get Add-on
  3. 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.

Launch Amigo to import gas prices to Google Sheets

Select Custom API from the list of sources.

List of sources to connect

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.

Key: X-RapidAPI-Host
Value: gas-price.p.rapidapi.com

Key: X-RapidAPI-Key
Value: Your_Key_Value

Gas Price API headers

Click on Flatten to present the nested datasets in separate columns. Once the data are separated into columns, click on IMPORT.

Preview of the data imported

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.

Imported Gas Price data

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.

See Also

Here are a few other articles that you might find useful.

Import eBay Data to Google Sheets

Import Live Metal Prices Data to Google Sheets

Import Stock and Options Trading Data to Google Sheets

X
Hire expert data analysts on-demand. Get 30 Days Free Trial