In this article, we’ll learn how to import hotels information to Google Sheets–information such as room availability, prices, facilities, policities, and so on from around the world. We’ll be using Hotels.com API to retrieve these data.
We’ll use the Amigo add-on to pull data from Hotels.com into Google Sheets. Whether you’re a travel agent or just an individual looking for information looking for the best hotel deals, Amigo Data is the ideal tool.
With it you can easily check prices and compare them, get reviews for a hotel, and search for hotels and properties in any city or locality. And you get alerted instantly so that you can grab the best deals.
Read on to know to scrape data from Hotels.com and import hotels information to Google Sheets. Following are the steps to import hotels information to Google Sheets.
How to import hotels information to Google Sheets
Install the Amigo Data extension in Google Sheets
Install the Amigo Data Google Sheets add-on from the Google Workspace Marketplace by clicking the link given below. We’ll use it to scrape Hotels.com data and import the data to Google Sheets.
Click here to install.
Alternatively, you can get it from Google Sheets.
- Open Google Sheets
- Go to Extensions→Add-ons→Get add-ons
- Search for Amigo Data and install it.
Get the endpoint URL
We’ll use a third-party Hotels.com API on RapidAPI to scrape Hotels.com data and import hotel data into Google Sheets.
Sign up or log in to RapidAPI.
Once you’re logged in, go to the Hotels API Documentation page in RapidAPI.
Click on the Subscribe to Test button and subscribe to a plan after which you’ll be able to use the Hotels API and retrieve data from Hotels.com.
On subscribing to a plan (the free one included), an API key will be generated, which is used to authenticate API calls to RapidAPI.
Click Endpoints to go back to the Hotels API documentation. On the left is the list of the available endpoints that we can use to scrape specific hotels data from Hotels.com
Select any one, for example /locations/v3/search. This endpoint will return the available hotels in a particular region.
The key and the header are filled automatically and the query parameters are also filled with default values. We can change these with values of our choice.
The default parameters will return a list of available hotels in New York from Hotels.com.
For demonstration purposes, we’ll modify the parameters. We’ll change to London from New York. The optional parameters will also have to be modified accordingly. They may be either left blank or filled with valid values. The values can be got from the v2/get-meta-data endpoint.
Click the Test Endpoint button to check if the parameter values are valid. If it is, the success code will be displayed. Under the Code snippet is the Hotels API endpoint URL for the specified parameters along with the headers.
Change the language to (Shell) cURL from Node.js and copy the endpoint URL. Note also the headers. These will be used to pull Hotels.com data to Google Sheets.
Import the data to Google Sheets
Open Google Sheets and launch Amigo Data to import the Hotels.com data to Google Sheets. To connect to Amigo Data, click Extensions→Amigo Data→Connect.
You’ll be presented with a list of sources to connect to. Choose Custom API.
Enter the Hotels API endpoint URL in the API URL field. Do not include the apostrophes.
Then expand the Details tab and enter the headers.
Then add the queries by clicking the “+QUERY” button and then entering the query names and the values. Eg. Name: q, Value: London
Click the PREVIEW button. Flatten and expand the nested datasets and delete the columns that are not required. Then click IMPORT.
The data will be imported into Google Sheets in a moment. Below is a snippet of the imported data.
You can also get offers information for a specific hotel and other information by following the same procedure as described here. For POST request, change the method from GET to POST and enter the body in the Body(JSON) tab.
Once the data have been imported into Google Sheets, they can be updated automatically at regular intervals–hourly, daily, weekly or on custom days–should you so wish, and get these data sent to your inbox. Click here to learn how set a refresh schedule and set up alerts in Amigo Data.
Visit our blog for to find out about the kinds of data that you can import to Google Sheets and how you can track stock and other financial data from Google Sheets.
Some recommended articles: