Importar tablas de la Web a Google Sheets

We all know how resourceful Google Sheets application has become in our daily life. While it is extremely good with all the basic and advanced spreadsheet needs, it also lets us connect with the outside information with ease. For instance, if we need to import a web HTML table to Google Sheets, it has a native function called as IMPORTHTML formula. Here’s the syntax:

IMPORTHTML(url, query, index)

  • url – this is the address (link/URL) to the HTML page on the web, where the table or list that we are looking to import is located. This can either be a fully qualified URL string like “https://en.wikipedia.org/wiki/Demographics_of_the_world”. Or it can be a reference to a cell (like B1) where the URL is stored.
  • consulta – this will be either “list” or “table” depending upon which HTML structure contains the data we are trying to import.
  • índice – the index number that uniquely identifies the list or table within the HTML page. Please note that the indexes for both lists and tables are treated separately. Both a table and list can exist with the same index number.

39

Automatice las transferencias de datos entre hojas de cálculo

Descubra cómo

Example: import a web HTML table to Google Sheets

Please consider the image below. B3 is the cell where we are entering the IMPORTHTML formula. On the web page where the URL (mentioned above) takes us, we are rather interested in the second table. Hence we’re going to use “table” for consulta parameter and 2 for el índice parámetro.

HTML Table to Google Sheets: IMPORTHTML Formula and Explanation Window

Nos aseguramos de que el url is within double quotes and hit the Enter key. As soon as we do that, Google Sheets tries to fetch the data. Bigger the table data, the longer it might take to finish the data import.

HTML Table to Google Sheets: Google Sheets Fetching Data

Mientras la importación de datos está en curso, la celda B3 parece contener un valor de error. Tenga en cuenta un pequeño triángulo rojo en la esquina superior derecha de la celda. Pero, no es un error real, sino un estado transitorio. Para confirmar, podemos pasar el ratón sobre la celda B3, para ver la descripción como se muestra a continuación.

HTML Table to Google Sheets: Snapshot of Data Loading

Una vez que Google Sheets cargue los datos, el triángulo rojo en la celda B3 desaparecerá. Notaremos que los datos se extienden desde la celda B3 hacia la derecha y también hacia abajo.

HTML Table to Google Sheets: Imported Sample Data of Cities and Details

We may not know how far the data is going to extend. So, it is very important that we keep the expected real estate of the result, clear of any preoccupied values. Otherwise, the IMPORTHTML formula will return a ¡#REF! error, as shown in the snapshot below. Please note, for the purposes of demonstration, we entered a dummy value in the cell C9.

HTML Table to Google Sheets: REF Error

Congratulations! We now learned how to import a web HTML table to Google Sheets, by making use of the native IMPORTHTML formula! Go through the following blog post to learn how to import RSS feed to Google Sheets.

39

Automatice las transferencias de datos más allá de Importrange

Descubra cómo

También te puede gustar...

funciones y fórmulas de google sheets

Las 5 mejores fórmulas de matrices dinámicas de Google Sheets 

Google Sheets ha evolucionado más allá de las hojas de cálculo básicas. Con la introducción de fórmulas de matriz dinámica, los usuarios ahora pueden manipular y analizar...
funciones y fórmulas de google sheets

Dominio de la fórmula FILTER: 4 casos de uso con ejemplos

La fórmula FILTRO de Google Sheets es una herramienta versátil para extraer datos que cumplen unas condiciones específicas. A diferencia de la fórmula QUERY,...
funciones y fórmulas de google sheets

Cómo liberar el poder de SUMIF y SUMIFS en Google Sheets: 4 casos de uso reales

Las fórmulas SUMIF y SUMIFS de Google Sheets son herramientas indispensables para realizar sumas condicionales. Simplifican las complejas...