In order to enhance user experience and cater to specific needs, certain websites utilize location-based content adaptation, dynamically adjusting their offerings, language, currency, and personalized information based on the geographical information of the user.
This is typical for example for some large and international e-commerce websites. For example on Amazon, you may see the product delivery time and prices based on your country (determined by your IP address) from which you are opening the website.
The IMPORTFROMWEB() formula comes with a set of powerful options. And in order to scrape content or data that is location based, there’s the country_code option. Using it, you control the location and our bots fetch the webpage from an IP address of the specified location/country.
We are using the Alpha-2 ISO country codes for this option (there are more than 240 countries available). This is how this option looks like in action:
=IMPORTFROMWEB(data_sources, selectors, "country_code:us")
Whenever there is a difference between the data that you see on the website and the data that you get with the =IMPORTFROMWEB() function, the country_code option is one of the first things to try.
There are more than 240 supported countries from which you can scrape the content. You can find the full list of the supported countries on the following page.
You can also set the location based scraping using our sidebar in the Google Sheets. On the next screenshot you can see where you can find this option on the page:
Please note, that for location based scraping, the process requires more resources and is slower. Therefore, we recommend you to use the country_code option only in cases where it is absolutely necessary.