The baseSelector option indicates the root element from which the other selectors will be evaluated.

It is useful to display search results  (for instance from Google SERP or any e-commerce website) as it ensures that each result is aligned on its base.

Let’s say you need to extract the titles and prices from a list of search results in which not all the results have a price. Without defining a base selector, the function will not be able to link the title to the right price. Instead it will output a list of titles in one column and a list of prices in a second column but the price next to the title might not correspond.

By describing the container that wraps the title, price, etc, the function will leave a blank cell when there is no price, ensuring that titles and prices always correspond.

Here is in a example:

In that case, we’ve defined the baseSelector so the function understands that it should align the ratings relatively to their corresponding titles and urls, or leave a blank if no rating shows up

As any other option of =IMPORTFROMWEB( ), there are 2 ways to include the baseSelector option :

  • as a text in the function : =IMPORTFROMWEB(data_sources, selectors, “baseSelector:title”)
  • referencing to a two-columns range